PDA

View Full Version : All outputs/Ports in LOW state ?



zorgloub
- 3rd February 2022, 12:13
Hello to the community.

With a Basic Stamp 2sx, it is possible to initialize all outputs (all ports) to the low state with the command OUTS=%0

However, this does not seem to work at compile time (PBP2.46)

For a PIC16F814A, I solve with the code below, but isn't there a simple command for this?

CODE:
------------

'All ports Low state
'OUTS = %0 'Does not work after compiling!

for i = 0 to 12
low i
next
---------------------------------------

Thank you.

HenrikOlsson
- 3rd February 2022, 16:28
I don't know what a 16F814A is, there doesn't seem to be such a device. Do you mean (the ancient) 16F84A?

If your device have a PORTA and a PORTB

TRISA = 0 ' All pins of PORTA as outputs
TRISB = 0
PORTA = 0 ' All pins of PORTA logic low
PORTB = 0


If the device has any analog functions (comparator and ADC) then those will most likely need attention before the pins will function correctly as digital pins.

zorgloub
- 3rd February 2022, 17:26
Thanks Henri.

Yes, 16F84A. (Typing error !)
With PortA and PortB.