Help on lCD and PIC18F4550 setup


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223


    Did you find this post helpful? Yes | No

    Default Re: Help on lCD and PIC18F4550 setup

    Hi, I'm trying to run this example code using the Matrix keypad routine from Mister_e
    Code:
    INCLUDE "KeyPad.bas"    asm 
        __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        __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
         
    
    
        '                      
        '    Hardware connection
        '    ===================
        DEFINE KEYPAD_ROW        4       ' 8 row 
        define KEYPAD_ROW_PORT   PORTD   '   on PORTB
        DEFINE KEYPAD_ROW_BIT    4       '      
        DEFINE KEYPAD_COL        4       ' 4 col 
        DEFINE KEYPAD_COL_PORT   PORTD   '   on PORTA
        DEFINE KEYPAD_COL_BIT    0       '      
        DEFINE KEYPAD_DEBOUNCEMS 200     ' debounce delay = 200 mSec
        define KEYPAD_AUTOREPEAT 1       ' use auto-repeat
        
        '
        '    Serial Communication definition
        '    ===============================
        'DEFINE HSER_TXSTA 24h            ' enable transmit, BRGH=1
        'DEFINE HSER_SPBRG 129            ' 9600 Bauds
    
    
        '   
        '    Variables definition 
        '    ===================
        myvar                    var byte
    
    
        '    ---------------------------------[Program Start]----------------------------------------------
    start:
        @ READKEYPAD _myvar
        Lcdout $fe, 128,"Key=",dec myvar
        goto start
    But the program just freeze on my easypic6, initially displays "Key=20", I'm using PortD for my keypad(4x4) and I made sure I have pull down-PortD. I set DEFINE KEYPAD_COL_BIT 0 and DEFINE KEYPAD_ROW_BIT 4 (I also tried to inverse them 4-0) but the same problem. Can you tell me what I'm doing wrong on my setup?


    thanks,
    tacbanon
    Attached Images Attached Images  

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts