Ok, I understand pretty much how the chip works, it was the bridge between how Picbasic language treat the shiftin code that was troubling me.
Ok I have this code on a Pic16F887, I am only getting '00' as my output, I tried switcing ports ( CP and PL just to see, but no luck). My parallel input have random 0 and 5v for try out.
Code:
'@ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
OSCCON = %01110000 '8 Mhz
DEFINE OSC 8
ANSELH = 0
'/////////////////////////
'// LCD configuration //
'/////////////////////////
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus RB.4, RB.5, RB.6, RB.7
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits) '4 therefore put wire at 4, 5, 6 and 7 of LCD
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 2000
pause 500
TRISE = %11111100 ' Set PORTE to all input
Clock var PORTE.0 'CP
Load var PORTE.1 'PL
Data_1 var PORTE.2 'Q7 out
input1 var byte
Mainloop:
pulsout Load,1
shiftin Data_1,Clock,0,[input1 \8]
lcdout $FE,1, "Shift in"
lcdout $FE,$C0, dec2 input1
pause 300
GOTO Mainloop
End
Bookmarks