Sonsivri

Electronics => Pic Basic Languages => Topic started by: MicroBox on October 09, 2011, 03:25:56 03:25



Title: Serial comm with PBP
Post by: MicroBox on October 09, 2011, 03:25:56 03:25
Hi everyone, I'm sorry to post this question here, but I'm really stuck and I can not get any display to my LCD. I'm trying to read data from an Rfid module using Pic18F4550. Here is the code I'm using
Code:
Include "modedefs.bas"          ' Include serial modes
asm
    __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    ;__CONFIG    _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    __CONFIG    _CONFIG1H, _FOSC_XTPLL_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
                            ;                  ;               ; Oscillator Switchover mode disabled
                            ;                  ; Fail-Safe Clock Monitor disabled
                            ; XT oscillator, PLL enabled, XT used by USB
    __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
    __CONFIG    _CONFIG2H, _WDT_OFF_2H
    __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H
    __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L  & _XINST_OFF_4L & _DEBUG_OFF_4L
    endasm
DEFINE OSC 48
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
PAUSE 100

TRISB.7=1
A0 var PORTB.7
DataRec Var byte

loop1:
     Serin A0,T9600,DataRec
     Lcdout $fe, 1        ' Clear screen
     Lcdout "V: ", DataRec
     pause 500   
     goto loop1
I hope you can help me.

thanks,
microbox


Title: Re: Serial comm with PBP
Post by: Wizpic on October 09, 2011, 08:31:27 08:31
I don't think think that PortB can be used for serial com
try this
TRISC.7=1
A0 var PORTC.7
I don't use PBP and there is just a slight defference between PDS and PBP


Title: Re: Serial comm with PBP
Post by: MicroBox on October 10, 2011, 01:41:52 01:41
Hi, thanks for the tip, I got it working now. :)

regards,
microbox