I tried the the new print command for long integers,but it doesn't work for me on ATtiny2313 + LCD. After some investigation i found out, that arithmetics give strange results with long and integer-variables. Tried with another AVR (Mega48) and serial communication and got the same issue.
This code works proper on PIC (with differences for the first lines of course) but with different results on AVR:
'ATmega48:#chip mega48, 1'ConfiguringUART:#defineUSART_BAUD_RATE1200#defineUSART_BLOCKINGDirPORTD.1OutDimlVarasLongDimiVarasInteger'Testing LONG arithmetics:HSerSend 13lVar = 22222 / 2HSerPrint [word]lVar 'shouldgive11111,o.k.HSerSend13lVar=lVar*2HSerPrint[word]lVar'should give 22222, o.k.HSerSend 13lVar = lVar / 2HSerPrint [word]lVar 'shouldgive11111,butgives0HSerSend13lVar=12345lVar=lVar%1000HSerPrint[word]lVar'should give 345, but gives 255HSerSend 13'TestingINTEGERarithmetics:HSerSend13iVar=22222/2HSerPrintiVar'should give 11111, o.k.HSerSend 13iVar = iVar * 2HSerPrint iVar 'shouldgive22222,butgives-23601HSerSend13iVar=22222iVar=iVar/2HSerPrintiVar'should give 11111, but gives 1HSerSend 13iVar = 12345iVar = iVar % 1000HSerPrint iVar 'shouldgive345,butgives12345HSerSend13wait200msEnd
Hi!
I tried the the new print command for long integers,but it doesn't work for me on ATtiny2313 + LCD. After some investigation i found out, that arithmetics give strange results with long and integer-variables. Tried with another AVR (Mega48) and serial communication and got the same issue.
This code works proper on PIC (with differences for the first lines of course) but with different results on AVR:
Regards
_________________________
Steini