Hello Folks,
I am trying to control these tiny LEDs with my switches, right now 8 for 8 but it is going to be 25 for 25 in the end so this is just a proto to figure out whats going on. MY code is working in a sense, I just happen to get high all of my LEDs like I wanted and made some low according to me, but when I try to connect them to my switches which are lying on the PORTB, I just could control the PINO of the PORTB, I am pasting my code below, and looking for your answers.
Thanks in advance
ilteris.
Code:
define OSC 4
start:
TRISC = 0
TRISB = 1
PORTC = 255
PORTB = 255
i var BYTE
j var BYTE
myByte var BYTE
delayTime var Byte
mySwitch var byte
delayTime = 100
pause delayTime
main:
for j=0 to 7
if PORTB.0(j) = 1 then
mybyte.0(j) = 0
PORTC = myByte
else
mybyte.0(j) = 1
PORTC = myByte
endif
next
for i=0 to 7
if i = 4 then
myByte.0(i) = 0
PORTC = myByte
else
myByte.0(i) = 1
PORTC = myByte
endif
next
goto main
Bookmarks