Hi there!
This program I intend to convert serial to parallel. Say, serial input is 101, I want it convert to parallel by lighting 3 LEDs. I use 16F628 with RB0 the clock input (60hz square wave) and RB1 as data input which is a 1ms pulse right after the zero crossing of clock. When I simulate this, 4 LEDs are just blinking at the same time very fast instead of blinking 101 as I would expect. What could be wrong? Thanks...
INCLUDE "modedefs.bas"
@ DEVICE MCLR_OFF, INTRC_OSC, WDT_OFF, LVP_OFF, PWRT_ON, PROTECT_OFF
CMCON = 7 'Comparators off
VRCON = 0 ' Vref off
TRISB.0 = 1
TRISB.1=1
TRISA =%00000
DIPIN var byte
wvar var byte
CLPIN VAR bit
here:
PORTA=0
SHIFTIN DIPIN,CLPIN,MSBPRE,[wvar\6]
PORTA=wvar
pauseus 500
PORTA=0
goto here
end
Bookmarks