manwolf
- 14th June 2008, 19:46
Following mister_e's suggestion, I decided to run the examples included with the board.
I don't use their compiler, but they include a HEX file and the code.
' *
' * Project name
' Lcd_Test (Simple demonstration of the LCD Library functions)
' * Copyright
' (c) MikroElektronika, 2005-2008
' * Description
' This is a simple demonstration of LCD library functions. LCD is first
' initialized, then some text is written at the first row.
' * Test configuration
' MCU PIC16F887
' Dev.Board EasyPIC5
' Oscillator HS, 08.0000 MHz
' Ext. Modules LCD 2x16
' SW mikroC v8.0
' * NOTES
' None.
' *
program Lcd_Test
dim text as string[16]
main:
ANSEL = 0 ' Configure AN pins as digital I/O
ANSELH = 0
text = "mikroElektronika"
Lcd_Config(PORTB,3,2,1,0,PORTB,4,7,5) ' Lcd_Init_EP5, see Autocomplete
LCD_Cmd(LCD_CLEAR) ' Clear display
LCD_Cmd(LCD_CURSOR_OFF) ' Turn cursor off
LCD_Out(1,1, text) ' Print text to LCD, 1st row, 1st column
Delay_ms(1000)
LCD_Out(2,6,"mikroE") ' Print text to LCD, 2nd row, 6th column
end.
Loaded this up and to my surprise nothing, zip, nada. LCD has blocks, LEDs off.
Using PIC16F887 included with the board.
But if I load one of their other LCD examples it works.
So I fired up PBP and wrote this.
' PicBasic Pro program to display a message on LCD
' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
'Define LOADER_USED 1
define OSC 8
' Define LCD registers and bits
Define LCD_DREG PORTB
Define LCD_DBIT 0
Define LCD_RSREG PORTB
Define LCD_RSBIT 4
Define LCD_EREG PORTB
Define LCD_EBIT 5
TRISB = 0
Low PORTB.4 ' LCD R/W line low (W)
Pause 250 ' Wait for LCD to start up
loop: Lcdout $fe, 1 ' Clear screen
Pause 250 ' Wait .5 second
Lcdout $FE, $80, "16F84 Working"
Pause 500 ' Wait .5 second
Lcdout $fe, $c0, "Board : 8MHz"
Pause 2000 ' Wait .5 second
Goto loop ' Do it forever
End
No luck with the 887 PortB.4 LED lights and stays on, but if I change to 16F84 it works fine so I know I'm not too crazy.
I have set the config bits every way I can think of, no luck.
I am sure I am over looking something. I am thinking about downloading MikoBasic but don't really see any point.
Can someone rub my nose in it?
I don't use their compiler, but they include a HEX file and the code.
' *
' * Project name
' Lcd_Test (Simple demonstration of the LCD Library functions)
' * Copyright
' (c) MikroElektronika, 2005-2008
' * Description
' This is a simple demonstration of LCD library functions. LCD is first
' initialized, then some text is written at the first row.
' * Test configuration
' MCU PIC16F887
' Dev.Board EasyPIC5
' Oscillator HS, 08.0000 MHz
' Ext. Modules LCD 2x16
' SW mikroC v8.0
' * NOTES
' None.
' *
program Lcd_Test
dim text as string[16]
main:
ANSEL = 0 ' Configure AN pins as digital I/O
ANSELH = 0
text = "mikroElektronika"
Lcd_Config(PORTB,3,2,1,0,PORTB,4,7,5) ' Lcd_Init_EP5, see Autocomplete
LCD_Cmd(LCD_CLEAR) ' Clear display
LCD_Cmd(LCD_CURSOR_OFF) ' Turn cursor off
LCD_Out(1,1, text) ' Print text to LCD, 1st row, 1st column
Delay_ms(1000)
LCD_Out(2,6,"mikroE") ' Print text to LCD, 2nd row, 6th column
end.
Loaded this up and to my surprise nothing, zip, nada. LCD has blocks, LEDs off.
Using PIC16F887 included with the board.
But if I load one of their other LCD examples it works.
So I fired up PBP and wrote this.
' PicBasic Pro program to display a message on LCD
' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
'Define LOADER_USED 1
define OSC 8
' Define LCD registers and bits
Define LCD_DREG PORTB
Define LCD_DBIT 0
Define LCD_RSREG PORTB
Define LCD_RSBIT 4
Define LCD_EREG PORTB
Define LCD_EBIT 5
TRISB = 0
Low PORTB.4 ' LCD R/W line low (W)
Pause 250 ' Wait for LCD to start up
loop: Lcdout $fe, 1 ' Clear screen
Pause 250 ' Wait .5 second
Lcdout $FE, $80, "16F84 Working"
Pause 500 ' Wait .5 second
Lcdout $fe, $c0, "Board : 8MHz"
Pause 2000 ' Wait .5 second
Goto loop ' Do it forever
End
No luck with the 887 PortB.4 LED lights and stays on, but if I change to 16F84 it works fine so I know I'm not too crazy.
I have set the config bits every way I can think of, no luck.
I am sure I am over looking something. I am thinking about downloading MikoBasic but don't really see any point.
Can someone rub my nose in it?