Page 1 of 1

16F628A Port B connected LEDS

Posted: Thu May 14, 2009 7:45 am
by IAB48
Hi
I am simulating a 16F628a and i have leds connected to B0, B3, B4, B5. I wanted to flash these ports on and off about 4 times and then leave B5 on.

I tried this using port masking checking the ports listed above and also by trying by just selecting all ports without masking. the only port that flashes is B0. If on the other hand i just select one port at a time IE sat bit 3 on port B the led associated with that port flashes as expected.

My though is that the ports need telling that they are outlets but I can't see how to set that in the simulation mode.

Any ideas

Thanks and Regards

Re: 16F628A Port B connected LEDS

Posted: Thu May 14, 2009 8:20 am
by Benj
Hello

The ports are configured as outputs when you use an output icon. If you are using masking then only the masked outputs will work which explains the problem you are having. What about toggling the bits in a byte variable and then simply writing the variable to the port.

Re: 16F628A Port B connected LEDS

Posted: Thu May 14, 2009 9:59 pm
by IAB48
OK
I had the set up as recommended, ie masking the correct ports. What I found worked was use a variable. i called one variable for setting masked outputs high and another variable for setting masked outputs low.

I made variable B_output_high = 255 and B_output+low = 0 and used the mask to set the correct ports

Cheers

Ian