fuse bytes

This forum is for posts that might be considered off-topic but that may be useful or interesting to members. Examples include posts about electronics or programming in general, other microcontrollers or interesting devices, useful websites, etc.
Post Reply
rich
Posts: 81
Joined: 19 November 2015, 12:23 PM

fuse bytes

Post by rich »

Is there a way to read the fuse byte with ZBasic code for the 328p device?

Ricahard
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: fuse bytes

Post by dkinzer »

rich wrote:Is there a way to read the fuse byte with ZBasic code for the 328p device?
There is no ZBasic function that allows direct reading of the fuse bytes. However, there is a multi-step process that you can use to read a fuse byte, one that requires a little assembly language code and also requires interrupts to be disabled temporarily. See section 25.2.2 of the ATmega328P datasheet.

http://ww1.microchip.com/downloads/en/D ... asheet.pdf

If you need some help writing the assembly language code, I can provide some early in the week - I'm traveling at the moment.
- Don Kinzer
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

The attached .zip file contains a ZBasic project that demonstrates how to read fuse bytes and the lock byte on a ZX328N. The functionality is implemented in an AVR assembly language file (that may need to be modified for other base devices). It has been tested on a ZX328N and seems to produce the correct results.
Attachments
FuseBytes.zip
(1006 Bytes) Downloaded 281 times
- Don Kinzer
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

The attached .zip file is another implementation of the code to retrieve fuse bytes. This one doesn't use an assembly language file but does use some inline C code that utilizes some knowledge of the generated names for parameters and return values.

As with the last one, it is written specifically for the ATmega328P-based devices and might need some minor changes for other devices.
Attachments
FuseBytes2.zip
(721 Bytes) Downloaded 281 times
- Don Kinzer
rich
Posts: 81
Joined: 19 November 2015, 12:23 PM

Post by rich »

Thank you much Don.

Your support is amazing.

Richard
Post Reply