Quantcast
Channel: MCS Electronics Forum
Viewing all 20555 articles
Browse latest View live

BASCOM-AVR : PCINT does not work on every input-pin : REPLY

$
0
0
You need to read the datasheet, as you are responsible for correctness of your code. If you address the point of 'it did not complain, thus it was supposed to work': there are tons of occasions in micro-controller programming, in Bascom and other programming languages to write something that looks ok, but won't work. Even it would be possible to ask why you was not warned about using an improper interrupt vector, you need to ask how many man-hours or -years of work have to go into catching up simple user errors and report them. This can be a hole without bottom, so catching up errors needs to stop somewhere and that's where user's responsibility starts.

BASCOM-AVR : Synchronizing serial strings : NEWTOPIC

$
0
0
What would be the best way to synchronize serial strings like GPS NMEA sentences to extract data ? In PICBASIC PRO there are the WAIT a character and SKIP n characters commands.... I am using ATmega328p with hard and software UARTS [b:47310ba180][color=red:47310ba180](BASCOM-AVR version : 2.0.8.1 )[/b:47310ba180][/color:47310ba180]

BASCOM-AVR : Synchronizing serial strings : REPLY

$
0
0
[quote:b323f3dba1="acjacques"]What would be the best way to synchronize serial strings like GPS NMEA sentences to extract data ? In PICBASIC PRO there are the WAIT a character and SKIP n characters commands.... I am using ATmega328p with hard and software UARTS [b:b323f3dba1][color=red:b323f3dba1](BASCOM-AVR version : 2.0.8.1 )[/b:b323f3dba1][/color:b323f3dba1][/quote:b323f3dba1] Hi, acjacques Please check this two topic: [url]https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12677&start=0&postdays=0&postorder=asc&highlight=gprmc[/url] [url]https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=11603&start=0&postdays=0&postorder=asc&highlight=gprmc[/url] Leslie

BASCOM-AVR : Synchronizing serial strings : REPLY

$
0
0
Also read about the split command in bascom very useful to break up strings with delimiters in them Regards Paul

BASCOM-AVR : Synchronizing serial strings : REPLY

$
0
0
The page is in Japanese, but please translate it into the language of your country. http://www.ne.jp/asahi/shared/o-family/ElecRoom/AVRMCOM/GPS_AE-GYSFDMAXB/GPS_AE-GYSFDMAXB.html http://translate.google.com/translate?hl=ja&sl=auto&tl=en&u=http%3A%2F%2Fwww.ne.jp%2Fasahi%2Fshared%2Fo-family%2FElecRoom%2FAVRMCOM%2FGPS_AE-GYSFDMAXB%2FGPS_AE-GYSFDMAXB.html&sandbox=1

Share your working BASCOM-AVR code here : 2.8inch 65K FullColorLCD 240x320dot [ILI9341] : REPLY

$
0
0
Error accure because [Dim Offset 256 As Byte] missed. I try to use another LIB (ST7735R) on ATXMEGA128A3U but I'm not successful. I don't know, how can modify LIB file.

Share your working BASCOM-AVR code here : 2.8inch 65K FullColorLCD 240x320dot [ILI9341] : REPLY

$
0
0
If you can not solve with the forum information, you need to present what kind of error you will get or the source file where the error will occur. Otherwise you can not get help.

Share your working BASCOM-AVR code here : 2.8inch 65K FullColorLCD 240x320dot [ILI9341] : REPLY

$
0
0
Hello. I can compile file without error, but nothing is shown on display. In attach is modified your file on ATXMEGA128A3U. Best regards. M.

BASCOM-AVR : Corrupted Bootloader when programming ATmega328p : NEWTOPIC

$
0
0
I had 2 processors ATmega328p with corrupted bootloader when programming with Bascom. The processors were loaded with Arduino bootloader 57600 baud. I could only recover reprogramming with USBASP thru ICSP. This have ocurred only in about 0,1 % of my programming tasks. What would be the cause? A bad USB contact when uploading ? [b:c5c05c8dd4][color=red:c5c05c8dd4](BASCOM-AVR version : 2.0.8.1 )[/b:c5c05c8dd4][/color:c5c05c8dd4]

BASCOM-AVR : Corrupted Bootloader when programming ATmega328p : REPLY

$
0
0
Could be many causes, but a possible protection is program the bootloader, then set the fuses so that writing into the bootloader area is disabled.

BASCOM-AVR : PCINT does not work on every input-pin : REPLY

$
0
0
[quote:87f90ca057]"ON PCINT18 my_ISR"[/quote:87f90ca057] yes it will compile since ON is not only used for interrupts but also for data sets. ON value ... And since PCINT18 is a numeric constant it will be seen as valid.

BASCOM-AVR : Corrupted Bootloader when programming ATmega328p : REPLY

$
0
0
so you are using arduino boot loader? maybe it overwrites the application area. check the file size you try to write to the processor. or ask on arduino forum. i can recommend to use the MCS boot loader. i use it for a long time and never failed me.

BASCOM-AVR : Corrupted Bootloader when programming ATmega328p : REPLY

$
0
0
Thanks for suggestion to use MCS Bootloader. I was using Arduino Bootloader because it already come loaded in my chips. I am a newbie in AVR Bascom and I am in the begining of learning curve. I will try to adapt one bootloader sample to ATmega 328p Crystal 16MHz 57600 baud HW UART and LED at PORTB.5. But I can't figure how a USB bad contact when loading a program could corrupt the bootloader itself.

BASCOM-AVR : Corrupted Bootloader when programming ATmega328p : REPLY

$
0
0
I would doubt its a bad USB contact, USB has a lot of built-in error checking that should at the very least just fail, not receive bad data. But apart from that, it only takes one corrupted address to go through and write into the bootloader, instead of main program area. Setting the bootloader protect fuse will at least prevent that. And yes, as Mark suggests, his bootloader works without any problems.

BASCOM-AVR : Corrupted Bootloader when programming ATmega328p : REPLY

$
0
0
The locking fuse bits of chips were all unprogramed. The corruption was done when uploading a code thru UART to Arduino bootloader. I could not set the locking bits because I am still in development process then I need often upload new testing codes and the UART programing is more convenient. I also doubt that it was the USB connector bad contact the corruption cause. Could be a bug during compilation?

BASCOM-AVR : Corrupted Bootloader when programming ATmega328p : REPLY

$
0
0
But you can still program the lock bit which disables writing to the bootloader - as long as you are sure the bootloader works ! That does not stop you from loading new application code. I seriously doubt there is a compiler error - Bascom is very stable for a long time, and certainly I never saw anything like that over 20 years. and 10s of 1000s of program cycles.

BASCOM-AVR : absolute value of difference : NEWTOPIC

$
0
0
Hi all, working with unsigned vars, calculating the absolute value of the difference between to vars afforts a couple of steps. Example using byte-constants: 89-5 = 84 'OK 5-89 = 171 'not the wanted result So what I do is to take care to always substract the lower value from the higher one. Pseudocode: if a > b then result = a - b else result = b - a end if My question: Is there a more elegant way tho achieve the same? [b:c8c7879c76][color=red:c8c7879c76](BASCOM-AVR version : 2.0.8.1 )[/b:c8c7879c76][/color:c8c7879c76]

BASCOM-AVR : absolute value of difference : REPLY

$
0
0
I test [code:1:a666e0d938] Dim J As Byte Dim K As Byte J = 89 - 5 Print J K = 5 - 89 Print K [/code:1:a666e0d938] I have an Error : 49 Line : 17 Value doesn't fit into BYTE [-84] , in File : D:pré poubellesoustraction.bas it is normal ! you can't do that with bascom if you declare K as an integer you don't have error [code:1:a666e0d938] Dim J As Byte Dim K As Integer J = 89 - 5 Print J K = 5 - 89 Print K [/code:1:a666e0d938] see the foundamentals in help About your speudocode , you find the elegant way JP :wink:

BASCOM-AVR : absolute value of difference : REPLY

$
0
0
Don't know if it is more elegant, but it is faster to do it in assembler by checking the carry flag and - if necessary - negate the result: [code:1:5b50ab1c50]dim a as byte dim b as byte dim c as byte a = 18 b = 88 gosub SubtractLowerFromHigher print c a = 77 b = 27 gosub SubtractLowerFromHigher print c end SubtractLowerFromHigher: !LDS r16,{a} !LDS r17,{b} !SUB r16,r17 !BRCC SubtractLowerFromHigher_1 !NEG r16 SubtractLowerFromHigher_1: !STS {c},r16 !RET[/code:1:5b50ab1c50]

BASCOM-AVR : absolute value of difference : REPLY

$
0
0
Thank you folks for your thougts! Laborratte: If often used, I find ASM in a sub to be quite elegant. Not for single use, but I'm sure I'll make use of it once in a while. Marc
Viewing all 20555 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>