Hay guys and girls. I've been playing around with this coding this afternoon and i keep getting errors and when i dont nothing going as i thought it should so any chance somone could point out whats wrong please or point me in the right dirrection at least!
My main coding:
Code:
TRISA=%00000011
TRISB=%00000000
TRISC=%11111110
ADCON0=%11000000
ADCON1=%00000111
INCLUDE "KeyPad.bas"
'
' Hardware connection
' ===================
DEFINE KEYPAD_ROW 8 ' 8 row
define KEYPAD_ROW_PORT PORTc ' on PORTB
DEFINE KEYPAD_ROW_BIT 0 ' <7:0>
DEFINE KEYPAD_COL 4 ' 4 col
DEFINE KEYPAD_COL_PORT PORTc ' on PORTA
DEFINE KEYPAD_COL_BIT 0 ' <3:0>
DEFINE KEYPAD_DEBOUNCEMS 200 ' debounce delay = 200 mSec
define KEYPAD_AUTOREPEAT 1 ' use auto-repeat
' LCD Display
' -----------
' Adjust these to suit your chosen LCD pinout
'
DEFINE LCD_DREG PORTb 'Define PIC port used for LCD Data lines
DEFINE LCD_DBIT 4 'Define first pin of portb connected to LCD DB4
DEFINE LCD_RSREG PORTb 'Define PIC port used for RS line of LCD
DEFINE LCD_RSBIT 3 'Define Portb pin used for RS connection
DEFINE LCD_EREG PORTb 'Define PIC prot used for E line of LCD
DEFINE LCD_EBIT 0 'Define PortB pin used for E connection
DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
DEFINE LCD_LINES 2 'Define using a 2 line LCD
DEFINE LCD_COMMANDUS 2000 'Define delay between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent.
'
' 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
hserout ["Key=",dec myvar,13,10]
gosub lcddisp
goto start
lcddisp:
LCDOUT $FE, 1, myvar
pause 60
return
end
The modified Keypad code
Code:
TRISA=%00000011
TRISB=%00000000
TRISC=%11111110
ADCON0=%11000000
ADCON1=%00000111
INCLUDE "KeyPad.bas"
'
' Hardware connection
' ===================
DEFINE KEYPAD_ROW 8 ' 8 row
define KEYPAD_ROW_PORT PORTc ' on PORTB
DEFINE KEYPAD_ROW_BIT 0 ' <7:0>
DEFINE KEYPAD_COL 4 ' 4 col
DEFINE KEYPAD_COL_PORT PORTc ' on PORTA
DEFINE KEYPAD_COL_BIT 0 ' <3:0>
DEFINE KEYPAD_DEBOUNCEMS 200 ' debounce delay = 200 mSec
define KEYPAD_AUTOREPEAT 1 ' use auto-repeat
' LCD Display
' -----------
' Adjust these to suit your chosen LCD pinout
'
DEFINE LCD_DREG PORTb 'Define PIC port used for LCD Data lines
DEFINE LCD_DBIT 4 'Define first pin of portb connected to LCD DB4
DEFINE LCD_RSREG PORTb 'Define PIC port used for RS line of LCD
DEFINE LCD_RSBIT 3 'Define Portb pin used for RS connection
DEFINE LCD_EREG PORTb 'Define PIC prot used for E line of LCD
DEFINE LCD_EBIT 0 'Define PortB pin used for E connection
DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
DEFINE LCD_LINES 2 'Define using a 2 line LCD
DEFINE LCD_COMMANDUS 2000 'Define delay between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent.
'
' 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
hserout ["Key=",dec myvar,13,10]
gosub lcddisp
goto start
lcddisp:
LCDOUT $FE, 1, myvar
pause 60
return
end
forgot to put the error code
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F876A "KEYPADTE.ASM" /l"KEYPADTE.lst" /e"KEYPADTE.err"
Error[113] C:\PBP\PBPPIC14.LIB 2784 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2785 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2789 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2790 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2800 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2871 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2889 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2913 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2920 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2928 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\PBPPIC14.LIB 2934 : Symbol not previously defined (PORTb)
Error[113] C:\PBP\KEYPADTE.ASM 100 : Symbol not previously defined (PORTc)
Error[113] C:\PBP\KEYPADTE.ASM 103 : Symbol not previously defined (PORTc)
Error[113] C:\PBP\KEYPADTE.ASM 125 : Symbol not previously defined (PORTc)
Error[113] C:\PBP\KEYPADTE.ASM 136 : Symbol not previously defined (PORTc)
Halting build on first failure as requested.
BUILD FAILED: Thu Nov 20 16:00:57 2008
Bookmarks