NOSTARTUP gottcha
Bean
Posts: 8,129
Something to look out for if you use the "NoStartup" option on the "PROGRAM" line.
The TRIS_x RAM locations are not set to $FF (all inputs) if you use "NoStartup".
As a consequence when you use INPUT or OUTPUT to change a pin (or use any command that sets a pin to input or output), it could set other pins to outputs.
As an example:
PROGRAM Start NoStartup
Start:
· INPUT RB.0 ' This could set any of the pins RB.1 to RB.7 to outputs
So if you use NoStartup you should set the TRIS_x registers like "TRIS_B = %11110000"
I just spent a hour finding this problem and I don't want you to have to do the same...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
COMING SOON "SD DATA LOGGER" www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·
The TRIS_x RAM locations are not set to $FF (all inputs) if you use "NoStartup".
As a consequence when you use INPUT or OUTPUT to change a pin (or use any command that sets a pin to input or output), it could set other pins to outputs.
As an example:
PROGRAM Start NoStartup
Start:
· INPUT RB.0 ' This could set any of the pins RB.1 to RB.7 to outputs
So if you use NoStartup you should set the TRIS_x registers like "TRIS_B = %11110000"
I just spent a hour finding this problem and I don't want you to have to do the same...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
COMING SOON "SD DATA LOGGER" www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·