Hello Melanie and Picnaut,


Melanie>>ADCom????

You found some secret register in this PIC that Microchip's not told us about?<<

Lets face it... at 3 Oclock in the morning, 8 hours later, I can dream up anything that doesn't work <chuckle>. Along with the inability to type and comprehend what I type!... I think it is called morning sickness... but since I am a male...It seems I was lacking in smarts as well as sleep...<g>

Melanie >>As is usual with PIC's that have Comparators, you need to switch them OFF and turn those ports Digital... see Datasheet section 10.0...

CMCON=7
<<

THATS IT! <g> CMCom not ADCom... We tried that.

Thereafter, don't forget TRISA=%00000011 too...

I will try to post some code... Since I am at work, I have no code to post this minute...but I am retrieving it from a friend now..<g>

Got it now... Here is the Code. Thanks a million in advance.


Dwayne


' Run on Pic 628/648a Serial in on PortA.1, Parallel out to LCD on B

Comd VAR BYTE '1 if next byte command for lcd, else zero
DataByte VAR BYTE 'data or command for lcd
Counter VAR BYTE 'counts incoming bytes

TRISA = $02 'input on porta.1
TRISB = $00 'all outputs
CMCON = $07 'shut off analog comparators

InitLCD:
DataByte = 13 'Turn on LCD
GoSub ComWrite

ReadLoop:
If PORTA.1 = 0 Then GoTo ReadLoop
'stay in loop until incoming data
'**stays in this loop forever. Can you tell me why?**

PORTA.0 = 1 'check timing of read
For Counter = 0 TO 7 step 1
PauseUs 500 'Pause to be adjusted until
'reads match incoming data
'try for 1200 baud first
DataByte = DataByte >> 1
DataByte.7 = PORTA.1 'shift serial into data

Next Counter

PORTA.0 = 0 'check timing compare length with
'incoming data stream on scope

IF Comd = 1 Then
GoSub ComWrite
GoTo ReadLoop
EndIF

IF DataByte = $FE Then
Comd = 1 'next byte command to LCD
GoTo ReadLoop
EndIF

DataWrite:
PORTB = DataByte
PORTA = $0C 'Enable on porta.3, command/data a.2
PauseUs 5
PORTA = $04
GoTo ReadLoop

ComWrite: 'sub writes a command to LCD
PORTB = DataByte
PORTA = $08
Comd = 0
PauseUs 5
PORTA = 0
Return