PIC Basic Code Understanding
I am Learning Pic Basic, and I took ADC Sample code from melabs. I woul like to understand the following LCD Defination
Define LCD registers and bits
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
Lastly
adval.highbyte = ADRESH ' Move HIGH byte of result to adval
adval.lowbyte = ADRESL ' Move LOW byte of result to adval
Will be thank full if Someone Helps me
LCD initialization problem
Quote:
Originally Posted by
malc-c
Using the attached image and the following code will better explain Henriks post with regards to using other ports
http://micro-heli.co.uk/lcd.jpg
Code:
DEFINE LCD_DREG PORTB ' LCD Data port
DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4)
DEFINE LCD_EREG PORTB ' LCD Enable port
DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD)
DEFINE LCD_RSREG PORTB ' LCD Register Select port
DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD)
DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us
You can then use the following to initialise the LCD
Code:
LCDOUT $FE,1:FLAGS=0:PAUSE 250:LCDOUT $FE,1:PAUSE 250 ' Initialize LCD
Hello Sir,
I am doing same things and working fine but sometimes when i power on the controller LCD doesn't display anything or it may display some garbage characters.
I am using pic 16f876A controller with crystal freq 10Mhz
LCD controller - Samsung KS0066
any suggestions are well comed...
thanks in advance
Re: Code for Serial Interrupt
Quote:
Originally Posted by
malc-c
if you can't attach the file by renaming it as .txt then use winzip or winrar to compress the files and then attach the zip/rar file to a post
Hello Sir,
i m sending u my code. I m using RS-485 bus network. I m using serial interrupt for 16f876A.
I m sending serially data 2 times from PC and get only 1 time on PIC16Fxx controller.
code:
DEFINE HSER_CLROERR 1
goto Main
DEFINE INTHAND myint
asm
; Save W, STATUS and PCLATH registers
myint
movwf wsave
swapf STATUS, W
clrf STATUS
movwf ssave
movf PCLATH, W
movwf psave
; Insert interrupt code here
; Save and restore FSR if used
bsf _LED ; Turn on LED (for example)
GOTO _Serial
; Restore PCLATH, STATUS and W registers
movf psave, W
movwf PCLATH
swapf ssave, W
movwf STATUS
swapf wsave, F
swapf wsave, W
retfie
endasm
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''
Main:
LOW LED
INTCON.6 = 1
INTCON.7 = 1
hserout [dec x," ", dec y]
lcdout $FE,1,#x," ",#y
here: goto here
Serial:
hserin [dec x,dec y]
' x = RCREG
' y = RCREG
low led
goto Main
'Resume