Hi, Little by little I'm learning to like the datasheet, I managed to compile the program, but there is no display on the Lcd, and also I noticed that RB0 is always high.
What did i miss?Code:DEFINE LCD_DREG PORTBDEFINE 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 'OSC is 20Mhz asm __CONFIG _CONFIG1L, _PLLDIV_5_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 TRISA.4 = 1 ' RA4/T0CKI = input to TMR0 counter TRISA.0 = 0 ' RA0 = output for LED TRISB.0 = 0 ' RB0 = output for LED CMCON = 7 ' All digital i var byte i=0 ' Assign prescaler to WDT for 1:1 prescale on TMR0 ' TMR0 clock will be from your external input on RA4/T0CKI ' Increment on high-to-low transitions ' If you prefer, then increment on low-to-high transitions T0CON = 11111000 'T0CON = TMR0ON T08BIT T0CS T0SE PSA T0PS2 T0PS1 T0PS0 ' Lcdout $fe, 128, "Counter: ", #i pause 100 Main: TMR0L = 0 ' Clear TMR0 count before start Loop1: WHILE TMR0L = 0 ' Wait for high-to-low transition WEND ' on RA4/T0CKI pause 100 PORTB.0 = 1 ' LED on to indicate transition seen i=i+1 ' Clear screen Lcdout $fe, 128, "Counter: ", #i PAUSE 100 PORTB.0 = 0 ' LED off GOTO Main ' Start over END
regards,
tacbanon


, I managed to compile the program, but there is no display on the Lcd, and also I noticed that RB0 is always high.


Bookmarks