karenhornby
- 9th April 2008, 12:31
I've done a stupid thing, I'm trying to learn how to program PIC's and thought I was doing well by getting a copy of PicBasicPro
All every well, then I needed someway of programming the pic to try it out, so me being a smartass went and got the EasyPic5 development board as it included sockets for various Pic's and also came with a 2 X 16 LCD
Great board, but it uses MikroBasic and unless you spend another £99 your limited to 2k in your program....ARGHH
I Hate MikroBasic!
I've been trying to get this working (untill I can sell the easypic5 board) by writing and compiling the program in PBP and then programming the pic on the easypic board by using the programming software that came with it
btw if anyone wants an almost new Easypic5 board, contact me, it's going cheap and only used for this one thing!
This SEEMS to work fine, but I've a problem.
Going back to basics, I've tried writing the "Hello World" program, it compiles fine, seems to load fine but just wont display anything on the pic
The Pic is a 16F677A with an 8Mhz xtal
The LCD is connected on the board as follows:
RS RB4
RW Vss/Ground/0V
E RB5
D7 RB3
D6 RB2
D5 RB1
D4 RB0
Here is my code:
Code:
'LCD DEFINATION**************************************** *************************
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus i.e, PortD.4-PORTD.7
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit i.e, PORTC.5
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 5 ' Set LCD Enable bit i.e, PORTE.4
DEFINE LCD_BITS 4 ' Set LCD bus size ot 4 bit Upper Nibble (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD to 4 Lines
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set data delay time in us
'************************************************* ******************************
Pause 500 ' Wait for LCD to startup
loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 500 ' Wait .5 second
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 500 ' Wait .5 second
Goto loop ' Do it forever
What Am I doing wrong? I'm sure its something really stupidly simple but I've spent so much time on this its frying my brain!
The board and LCD both work fine, I know because I've loaded several of the samples written already in Mikrobasic such as the one showing the lcd working and the temperature readout using the DS1820 both work fine.
All every well, then I needed someway of programming the pic to try it out, so me being a smartass went and got the EasyPic5 development board as it included sockets for various Pic's and also came with a 2 X 16 LCD
Great board, but it uses MikroBasic and unless you spend another £99 your limited to 2k in your program....ARGHH
I Hate MikroBasic!
I've been trying to get this working (untill I can sell the easypic5 board) by writing and compiling the program in PBP and then programming the pic on the easypic board by using the programming software that came with it
btw if anyone wants an almost new Easypic5 board, contact me, it's going cheap and only used for this one thing!
This SEEMS to work fine, but I've a problem.
Going back to basics, I've tried writing the "Hello World" program, it compiles fine, seems to load fine but just wont display anything on the pic
The Pic is a 16F677A with an 8Mhz xtal
The LCD is connected on the board as follows:
RS RB4
RW Vss/Ground/0V
E RB5
D7 RB3
D6 RB2
D5 RB1
D4 RB0
Here is my code:
Code:
'LCD DEFINATION**************************************** *************************
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus i.e, PortD.4-PORTD.7
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit i.e, PORTC.5
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 5 ' Set LCD Enable bit i.e, PORTE.4
DEFINE LCD_BITS 4 ' Set LCD bus size ot 4 bit Upper Nibble (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD to 4 Lines
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set data delay time in us
'************************************************* ******************************
Pause 500 ' Wait for LCD to startup
loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 500 ' Wait .5 second
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 500 ' Wait .5 second
Goto loop ' Do it forever
What Am I doing wrong? I'm sure its something really stupidly simple but I've spent so much time on this its frying my brain!
The board and LCD both work fine, I know because I've loaded several of the samples written already in Mikrobasic such as the one showing the lcd working and the temperature readout using the DS1820 both work fine.