OCR1A (mega168) showing negative signed (int) value in AS7

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Doing some += calcs to update 16bit output compare register for an atmeg168 and atmel studio is showing negative values when the OCR register overflows to a positive number only...

However in hexcode display converted shows anticipated correct unsigned values.

 

Clicking around to try to get it to show the correct unsigned 16 bit value.

 

*edit: As a work around, for testing i created an unsigned int to store OCR1A value to view. And i moved down to AS6 because it seems a bit peppier and my project is simple.

Attachment(s): 

~GuitarDude

Last Edited: Fri. Dec 22, 2017 - 06:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

for testing i created an unsigned int to store OCR1A value to view

What else would you use? Unless you are doing maths of some description always use unsigned, uint16_t in this case.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use the IO view, not watches for SFRs.