Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PicBasic Pro; routines between 16f876 and PCD5844

Status
Not open for further replies.

Tobie

Newbie level 1
Joined
Jun 11, 2004
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
20
how to receive serial data with picbasic pro

Hi,

I'm using a PIC 16f876 to communicate with philips PCD5844 driver on a nokia type 84 x 48 LCD.

I've had some help from a post here to initialise MSSP, and attempted to then write to the LCD using the example application in the PCD5844 datasheet.

I've had no luck seeing anything on the LCD. I'm using voltage dividers on each PIC pin to take the 5v level to 2.9v, otherwise the circuit is pretty simple.

My code is below, any suggestions would be greatly appreciated

best wishes,
Tobie




DEFINE LOADER_USED 1 'enable bootloader
define osc 20

'PIN Definitions:
'****************
LED_rfRX VAR PortC.4 'LED for Radio TX activity
LED_rfTX VAR PortC.5 'LED for Radio TX activity

'MSSP Pins:
LCD_PWR VAR PortC.0 '1 VDD supply voltage
LCD_SCK VAR PortC.1 '2 SCK serial clock input
LCD_SDIN VAR PortC.2 '3 SDIN serial data input
LCD_CS VAR PortC.3 '4 SCE chip enable
CMD_DAT VAR PortB.0 '5 D/C data/command
LCD_RST VAR PortB.6 '8 RES External reset Input

main:
GOSUB init_LCD
GOSUB write_LCD
GOSUB end_LCD

END


init_LCD:
HIGH LED_rfRX

SSPSTAT.6 = 1 'CKE
SSPCON.0 = 1 'TCK / 16
SSPCON.5 = 1 'ENABLE MSSP

HIGH CMD_DAT 'COMMAND / DATA LINE
HIGH LCD_CS 'LCD CHIP SELECT
HIGH LCD_PWR 'LCD POWER ENABLE
LOW LCD_RST 'LCD RESET LINE
PAUSE 20
HIGH LCD_RST

LOW CMD_DAT 'Pull low to send commands:

SSPBUF = 33 'EXTENDED COMMAND SET
PAUSE 1
SSPBUF = 200 'SETUP VOP
PAUSE 1
SSPBUF = 19 'SETUP BIAS
PAUSE 1
SSPBUF = 32 'NORMAL COMMAND SET
PAUSE 1

SSPBUF = 9 'TURN ON ALL SEGMENTS
PAUSE 100

SSPBUF = %00001100 'DISPLAY NORMAL
PAUSE 1

RETURN


write_LCD:

HIGH CMD_DAT ' GET READY TO SEND PIXEL DATA

SSPBUF = %00011111 'write column 1, 5 pixels from top
PAUSE 1
SSPBUF = %00000101 'etc
PAUSE 1
SSPBUF = %00000111 'etc
PAUSE 1
SSPBUF = %00000000 'etc
PAUSE 1
SSPBUF = %00011111 'etc
PAUSE 1
SSPBUF = %00000100 'etc
PAUSE 1
SSPBUF = %00011111 'etc
PAUSE 1

HIGH CMD_DAT ' GET READY TO SEND CONTROL DATA

SSPBUF = %00001101 'Inverse video mode
PAUSE 1
SSPBUF = %00000100 'set x address of ram (goto column 0)
PAUSE 1

LOW CMD_DAT ' GET READY TO SEND DISPLAY DATA

SSPBUF = %00000000 'blank column
PAUSE 1


RETURN


end_LCD:
HIGH LCD_CS ' DESELECT LCD
LOW LED_rfRX
RETURN
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top