set Tools>Options>Output>Output Setting>optimization-->Zero
and test code ! :
program MyProject
main:
if 150 > 300 then
portc=255
else
end if
end.
'------------
Run "Portc=255" !!!!!!!
fix Important bug in mikrobasic avr
fix Important bug in mikrobasic avr
- Attachments
-
- BUG.zip
- (55.81 KiB) Downloaded 143 times
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: fix Important bug in mikrobasic avr
Hi,
You forgot to initialize and configure the port.
Try this code, code works ok:
Best regards,
Peter
You forgot to initialize and configure the port.
Try this code, code works ok:
Code: Select all
program MyProject
' Declarations section
main:
' Main program
DDRC = 0xFF ' configure PORTC as output
PORTC = 0xAA ' initial PORTC value you can delete this if you want
if 150 < 300 then
portc = 0xFF
else
portc = 0x1A
end if
end.
Peter
Re: fix Important bug in mikrobasic avr
Hi , Peterpetar.timotijevic wrote:Hi,
You forgot to initialize and configure the port.
Try this code, code works ok:Best regards,Code: Select all
program MyProject ' Declarations section main: ' Main program DDRC = 0xFF ' configure PORTC as output PORTC = 0xAA ' initial PORTC value you can delete this if you want if 150 < 300 then portc = 0xFF else portc = 0x1A end if end.
Peter
in avr
When starting to work DDrX = 0 (all ports is Input)
and Portc = 255 ===> All PullUP resistors in Portc active
It does not matter!
A Question :
ex)
if 150 > 300 then
portc=255
else
end if
150 is smaller than 300
"Portc=255" command should not be executed
ex2)
program MyProject
dim c3 as char[3]
dim b as byte
main:
UART1_Init(19200)
b=0
if 150> 300 then
b=1
else
end if
ByteToStr(b,c3)
UART1_Write_Text(c3)
UART1_Write_Text("|")
end.
'---------------------------
150 is smaller than 300
"b=1" command should not be executed
But "B=1" command run!!!
and .... c3=1 !!!!
Please Test Attach File in Proteus software or ...
- Attachments
-
- BUG2.zip
- (78.78 KiB) Downloaded 152 times
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: fix Important bug in mikrobasic avr
Hi,
Please see screenshots in attachment.
Best regards,
Peter
Please see screenshots in attachment.
Best regards,
Peter
- Attachments
-
- UartIf.gif (949.39 KiB) Viewed 3734 times
-
- 150L300.gif (420.84 KiB) Viewed 3734 times
Re: fix Important bug in mikrobasic avr
Hi, Peterpetar.timotijevic wrote:Hi,
Please see screenshots in attachment.
Best regards,
Peter
Please see screenshots in attachment and test again.
- Attachments
-
- 1.gif (642.73 KiB) Viewed 3727 times
- marina.petrovic
- Posts: 2986
- Joined: 18 Apr 2013 08:11
Re: fix Important bug in mikrobasic avr
Hi,
I tested the simple examples that you posted and I didn't manage to reproduce the same behavior in my compiler,
like my colleague Petar already mentioned.
Please, try to update your compiler (Help -> Check for Updates).
Last version of mikroBasic PRO for AVR is v6.0.1.
Best regards,
Marina
I tested the simple examples that you posted and I didn't manage to reproduce the same behavior in my compiler,
like my colleague Petar already mentioned.
Please, try to update your compiler (Help -> Check for Updates).
Last version of mikroBasic PRO for AVR is v6.0.1.
Best regards,
Marina