16F628A Port B connected LEDS

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

IAB48
Posts: 13
Joined: Wed Feb 18, 2009 3:24 am
Contact:

16F628A Port B connected LEDS

Postby IAB48 » Thu May 14, 2009 7:45 am

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

User avatar
Benj
Matrix Staff
Posts: 14363
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4444 times
Been thanked: 4144 times
Contact:

Re: 16F628A Port B connected LEDS

Postby Benj » Thu May 14, 2009 8:20 am

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.

IAB48
Posts: 13
Joined: Wed Feb 18, 2009 3:24 am
Contact:

Re: 16F628A Port B connected LEDS

Postby IAB48 » Thu May 14, 2009 9:59 pm

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