Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Errors on ZERO and no errors on UNO (Read 1323 times)
mflum
Newbies
*
Offline


Posts: 2
Joined: Aug 25th, 2021
Errors on ZERO and no errors on UNO
Feb 7th, 2023 at 6:57am
Print Post  
The generic code I have compiles fine when I specify an UNO configuration. When I specify an Arduino Zero(Programming Port) configuration I get a lot of errors like "PORTB" and "TIMER0_COMPA_vect" and "cli" and "sei". Yet it compiles just fine with no errors when i specify UNO.

How do I fix this? Angry
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2441
Joined: Feb 13th, 2019
Re: Errors on ZERO and no errors on UNO
Reply #1 - Feb 7th, 2023 at 8:24am
Print Post  
Thanks for the report.

The PORTB register is specific to ATMega 8/168/328 Chips as shown in the Arduino Port Register documentation.  The Zero has a different set of registers which are 32bit instead of 8 bit.

Manipulation of the regsiters and timer vectors is low level so often becomes specific to a certain family or range of chips, and normally this is avoided by using the Arduino functions for digitalRead/Write or by using some of the libraries available which handle this element for you , such as digitalWriteFast is available for the Arduino Zero.

Hopefully this helps work towards converting your code for the Zero, or making it compatible with both family of chips using #ifdef statements to differentiate between the board in use.
« Last Edit: Feb 7th, 2023 at 8:25am by Simon@Visual Micro »  
Back to top
IP Logged
 
mflum
Newbies
*
Offline


Posts: 2
Joined: Aug 25th, 2021
Re: Errors on ZERO and no errors on UNO
Reply #2 - Feb 7th, 2023 at 9:14pm
Print Post  
Thank you for your response. If this is true, then why is code (with portb) running just fine on my Zero, when i compile using the Arduino IDE instead of the Visual Micro extension? Confused??
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Errors on ZERO and no errors on UNO
Reply #3 - Feb 7th, 2023 at 9:41pm
Print Post  
I suspect the port is not available when the Serial is being used. If the IDE set to "Debug" then the serial debugger will have been activated automatically on that port (that is the default setting).

If you switch the tool bar from Debug to Release and try compile does that work?


The yellow area at the top of this page is important when creating threads in this forum. It shows many useful configuration and build properties making it easier for us to provide support.
« Last Edit: Feb 7th, 2023 at 9:44pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint