PDA

View Full Version : Proton development board with Picbasic



pjsmith
- 25th July 2004, 18:33
Hi,

Anyone using one of these with MELABS Picbasic Pro? I've got one but the defaults for LCD etc are different as it's designed for their proton basic.

Does anyone have any code samples for it? I'd like to see a few examples of LCD output, adin etc.

Thanks.

carl_schell
- 25th July 2004, 19:32
PJ Smith -

I do not have the proton development board, but it is a very easy thing to modify LCD defaults or any other such thing.
All you do is change the DEFINE statements:

e.g.:

Lets say the default for the enable pin of the LCD is PortB.3
and your development board is wired for the enable pin of LCD connected to Port D.4. Simple:

'===Was===:

DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3

'===Change to===:

DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 4


Then simply add your code:

LCDOut $FE,1,"LCD working"

There are many define statement...refrence your PBP manual, Appendix B.

Best Regards;
Carl

www.schellelectronics.com

P.S. - You could also simply throw out your proton development board and purchase my PIC Deelopment Board with bootloader at www.schellelectronics.com ! ;)
It also comes with sample programs

pjsmith
- 25th July 2004, 20:31
Thanks for the quick answer. I've already looked at your site and would definately have gone for it if I didn't already have spent several hundred getting to where I am. I just wish I'd seen it earlier. I may still take you up on it :)

I had the following from the proton people

LCD_DTPIN = PORTD.4
LCD_RSPIN = PORTE.0
LCD_ENPIN = PORTE.1
LCD_INTERFACE = 4 ' 4-bit Interface
LCD_LINES = 2
LCD_TYPE = 0

SCL_PIN = PORTC.3
SDA_PIN = PORTC.4

SERIAL_BAUD = 9600
RSOUT_PIN = PORTC.6
RSOUT_MODE = TRUE
RSOUT_PACE = 1
RSIN_PIN = PORTC.7
RSIN_MODE = TRUE


HSERIAL_BAUD = 9600 ' Set baud rate to 9600
HSERIAL_RCSTA = %10010000 ' Enable serial port and continuous receive
HSERIAL_TXSTA = %00100100 ' Enable transmit and asynchronous mode
HSERIAL_CLEAR = ON ' Enable Error clearing on received characters


KEYPAD_PORT = PORTB

CCP1_PIN = PORTC.2
CCP2_PIN = PORTC.1

Symbol T300 = 3313 NO_LIST
Symbol N300 = 3313 + $4000 NO_LIST
Symbol T600 = 1646 NO_LIST
Symbol N600 = 1646 + $4000 NO_LIST
Symbol T1200 = 813 NO_LIST
Symbol N1200 = 813 + $4000 NO_LIST
Symbol T2400 = 396 NO_LIST
Symbol N2400 = 396 + $4000 NO_LIST
Symbol T4800 = 188 NO_LIST
Symbol N4800 = 188 + $4000 NO_LIST
Symbol T9600 = 84 NO_LIST
Symbol N9600 = 84 + $4000 NO_LIST

Symbol OT2400 = 396 + $8000 NO_LIST ' Open True
Symbol OT1200 = 813 + $8000 NO_LIST ' Open True
Symbol OT9600 = 84 + $8000 NO_LIST ' Open True
Symbol OT300 = 3313 + $8000 NO_LIST ' Open True

Symbol ON2400 = 396 + $4000 + $8000 NO_LIST ' Open Inverted
Symbol ON1200 = 813 + $4000 + $8000 NO_LIST ' Open Inverted
Symbol ON9600 = 84 + $4000 + $8000 NO_LIST ' Open Inverted
Symbol ON300 = 3313 + $4000 + $8000 NO_LIST ' Open Inverted


Symbol HOME = 1 NO_LIST
Symbol BELL = 7 NO_LIST
Symbol BKSP = 8 NO_LIST
Symbol TAB = 9 NO_LIST
Symbol CR = 13 NO_LIST

ALL_DIGITAL = TRUE ' Set PORTA and PORTE to all digital


So I've added

' LCD defines for proton board
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_RWREG PORTE


to the program and tried

LCDOut $FE,1,"LCD working"

but I still get nothing. The LCD is just showing squares, like it's always done. Does this look right to you?

Thanks for the newbie help!

carl_schell
- 25th July 2004, 21:40
PJ Smith -

Thanks for looking at our site.

As to your questions, one more thing you could check:

You didn't mention which PIC you are using...but i noticed some of your LCD pins are on port E...this is no problem, however, Port E on the 16F877A are Analog pins (when set to analog, pin can not output...only input, so must be changed to digital!) You can do this by setting your ADCON1 regester. e.g....to make all analog pins digital on the 16F877A type:

ADCON1 = 7

Also check your TRIS statements (1 = input, 0 = output)

If you need some of these set as analog, no problem, just look in the data sheet to set as desired

You have to set bits 3,2,1,& 0 to match your desired A or D
'***ADCON1 Register for 16F877A***
'Bit 7 => ADFM: A/D Result format select
' 1 = Right Justified. 6 most significant bits of ' ADRESH are read as ‘0’.
' 0 = Left Justified. 6 least significant bits of ' ' ADRESL are read as ‘0’.
'Bit 6 => Unimplemented: Read as ’0’
'Bit 5 => Unimplemented: Read as ’0’
'Bit 4 => Unimplemented: Read as ’0’
'Bit 3 => PCFG3 A/D Port Configuration Control bits
'Bit 2 => PCFG2 A/D Port Configuration Control bits
'Bit 1 => PCFG1 A/D Port Configuration Control bits
'Bit 0 => PCFG0 A/D Port Configuration Control bits

Check this to make sure you are ok.

Best of luck...

Carl
www.schellelectronics.com

pjsmith
- 25th July 2004, 22:19
Thanks very much. ADCON1 = 7 got the LCD working.

Pretty steep learning curve at the moment!