PIC+LCD = Fun
Another hour or so of fun tonight.
The other day I had some startup problems getting MikroBasic to interface with the LCD libraries. I chalked it up to me being new with the tool. I pinged my buddy Mike in Hartford to see if he could give me a code fragment to test my LCD.
Part of my initial challenge was that most of the examples that I was looking at were for 16F877 and I am working with a 16F628A. Trying to figure out code + the difference in chips + a development tool was bit much.
Mike sent me some code today and then I translated the pin layout of his system with a 16F877 to my 16F628A demo board. (I am using a PIC-EL III for this exercise.) I then had an issue with the MikroBasic libraries not playing properly again. I ended up refreshing the libraries and that solved my problem.
After playing with Mike's code I started to adapt it a bit to get a feel for how to work with it. My final project for tonight is 37 lines long with spaces and comments.
I am pretty excited about this. I am going to need to bond with my development platform a bit before I am fully comfortable with it. It is looking like a reasonable tool for developing my QRSS beacon keyer with.
Development: Ubuntu 10.4 64bit running MikroBasic under WINE.
Programmer: WinXP --> PIC-EL III (looks like a PICkit2 clone)
----Basic for tonights demo app----
program LCD04
'LCD Module Connections
dim LCD_RS as sbit at RB6_bit
LCD_EN as sbit at RB4_bit
LCD_D4 as sbit at RB0_bit
LCD_D5 as sbit at RB1_bit
LCD_D6 as sbit at RB2_bit
LCD_D7 as sbit at RB3_bit
LCD_RS_Direction as sbit at TRISB6_bit
LCD_EN_Direction as sbit at TRISB4_bit
LCD_D4_Direction as sbit at TRISB0_bit
LCD_D5_Direction as sbit at TRISB1_bit
LCD_D6_Direction as sbit at TRISB2_bit
LCD_D7_Direction as sbit at TRISB3_bit
'End LCD module Connections
main:
'PIC setup
TRISB = 0 ' Set PORTB as OUTPUT
PORTB = 0 ' Set PORTB all pins to 'off'
'End Pic Setup
'LCD Setup Section
LCD_Init() 'Initialize the LCD library
LCD_Cmd(_LCD_Clear) 'Clear the LCD display
LCD_Cmd(_LCD_Cursor_Off) 'Turns blinking cursor off
'End LCD Setup Section
LCD_Out(1, 6, "NG0R") 'Write text starting from row 1, column 6
LCD_Out(2, 2, "QRSS Beacon") 'Write text startfing from row 2, column 2
LCD_Cmd(_LCD_Cursor_Off) 'Turns blinking cursor off
end.
The other day I had some startup problems getting MikroBasic to interface with the LCD libraries. I chalked it up to me being new with the tool. I pinged my buddy Mike in Hartford to see if he could give me a code fragment to test my LCD.
Part of my initial challenge was that most of the examples that I was looking at were for 16F877 and I am working with a 16F628A. Trying to figure out code + the difference in chips + a development tool was bit much.
Mike sent me some code today and then I translated the pin layout of his system with a 16F877 to my 16F628A demo board. (I am using a PIC-EL III for this exercise.) I then had an issue with the MikroBasic libraries not playing properly again. I ended up refreshing the libraries and that solved my problem.
After playing with Mike's code I started to adapt it a bit to get a feel for how to work with it. My final project for tonight is 37 lines long with spaces and comments.
I am pretty excited about this. I am going to need to bond with my development platform a bit before I am fully comfortable with it. It is looking like a reasonable tool for developing my QRSS beacon keyer with.
Development: Ubuntu 10.4 64bit running MikroBasic under WINE.
Programmer: WinXP --> PIC-EL III (looks like a PICkit2 clone)
----Basic for tonights demo app----
program LCD04
'LCD Module Connections
dim LCD_RS as sbit at RB6_bit
LCD_EN as sbit at RB4_bit
LCD_D4 as sbit at RB0_bit
LCD_D5 as sbit at RB1_bit
LCD_D6 as sbit at RB2_bit
LCD_D7 as sbit at RB3_bit
LCD_RS_Direction as sbit at TRISB6_bit
LCD_EN_Direction as sbit at TRISB4_bit
LCD_D4_Direction as sbit at TRISB0_bit
LCD_D5_Direction as sbit at TRISB1_bit
LCD_D6_Direction as sbit at TRISB2_bit
LCD_D7_Direction as sbit at TRISB3_bit
'End LCD module Connections
main:
'PIC setup
TRISB = 0 ' Set PORTB as OUTPUT
PORTB = 0 ' Set PORTB all pins to 'off'
'End Pic Setup
'LCD Setup Section
LCD_Init() 'Initialize the LCD library
LCD_Cmd(_LCD_Clear) 'Clear the LCD display
LCD_Cmd(_LCD_Cursor_Off) 'Turns blinking cursor off
'End LCD Setup Section
LCD_Out(1, 6, "NG0R") 'Write text starting from row 1, column 6
LCD_Out(2, 2, "QRSS Beacon") 'Write text startfing from row 2, column 2
LCD_Cmd(_LCD_Cursor_Off) 'Turns blinking cursor off
end.