Impossible to send a character through UART

Started by Alain Paschoud October 20, 2003
Hi all,

I just bought a PIC16C63A. I compiled a program which now runs on it (I
toggle a pin of B-port and can see it). I just followed the example to
initialize the UART communication and want to send a byte... But
unfortunately, no byte is sent. The output voltage on PIN 17 (TX) is always
0.

The simulator (MPLAB SIM) allows to see what happens on ports, but I can't
see if a character is sent on serial line or not.

My program is very simple, it should simply send continuously the same
character. I attached it to this e-mail. Can someone tell me if I'm doing
something wrong ?

Thank you for any suggestions help or comments.

Best regards.

Alain Paschoud


Attachment (not stored)
send_char.asm
Type: application/octet-stream


Looks like it will fly to me.

Once the UART is set up correctly, reading it is just a matter of
reading the register when the receive flag is true.

I like your PWM method. I, being a real-time freak, would just add a
clock to sync everything.

Chad

--- Alain Paschoud <> wrote:
> Hi all,
>
> I just bought a PIC16C63A. I compiled a program which now runs on it
> (I
> toggle a pin of B-port and can see it). I just followed the example
> to
> initialize the UART communication and want to send a byte... But
> unfortunately, no byte is sent. The output voltage on PIN 17 (TX) is
> always
> 0.
>
> The simulator (MPLAB SIM) allows to see what happens on ports, but I
> can't
> see if a character is sent on serial line or not.
>
> My program is very simple, it should simply send continuously the
> same
> character. I attached it to this e-mail. Can someone tell me if I'm
> doing
> something wrong ?
>
> Thank you for any suggestions help or comments.
>
> Best regards.
>
> Alain Paschoud
>

> ATTACHMENT part 2 application/octet-stream name=send_char.asm
__________________________________




Arrrrrrgh. Wrong message. :-( Sorry, sorry, sorry, this reply goes to
Mark. I have printed out your program Alain, and may have a chance to
look at it tonight.

Chad

--- Chad Russel <> wrote:
> Looks like it will fly to me.
>
> Once the UART is set up correctly, reading it is just a matter of
> reading the register when the receive flag is true.
>
> I like your PWM method. I, being a real-time freak, would just add a
> clock to sync everything.
>
> Chad
>
> --- Alain Paschoud <> wrote:
> > Hi all,
> >
> > I just bought a PIC16C63A. I compiled a program which now runs on
> it
> > (I
> > toggle a pin of B-port and can see it). I just followed the example
> > to
> > initialize the UART communication and want to send a byte... But
> > unfortunately, no byte is sent. The output voltage on PIN 17 (TX)
> is
> > always
> > 0.
> >
> > The simulator (MPLAB SIM) allows to see what happens on ports, but
> I
> > can't
> > see if a character is sent on serial line or not.
> >
> > My program is very simple, it should simply send continuously the
> > same
> > character. I attached it to this e-mail. Can someone tell me if I'm
> > doing
> > something wrong ?
> >
> > Thank you for any suggestions help or comments.
> >
> > Best regards.
> >
> > Alain Paschoud
> >
>
> > ATTACHMENT part 2 application/octet-stream name=send_char.asm >
> __________________________________
>


__________________________________



Alain,

Initialization is wrong I believe:

MOVLW 0x20 ; not 0x40
MOVWF TXSTA

Port C is never set for output.
While in bank 1 of main:

MOVLW 0x0e
MOVWF TRISC

replace loop2 with:

loop2
movlw '55'h
btfss TXSTA, 1 ; checks to see if xmit buffer is empty
goto loop2
movwf TXREG ; load with new send character
goto loop

These are just a few problems I have found. If you still do not get it
working, get back to me.

Chad

--- Alain Paschoud <> wrote:
> Hi all,
>
> I just bought a PIC16C63A. I compiled a program which now runs on it
> (I
> toggle a pin of B-port and can see it). I just followed the example
> to
> initialize the UART communication and want to send a byte... But
> unfortunately, no byte is sent. The output voltage on PIN 17 (TX) is
> always
> 0.
>
> The simulator (MPLAB SIM) allows to see what happens on ports, but I
> can't
> see if a character is sent on serial line or not.
>
> My program is very simple, it should simply send continuously the
> same
> character. I attached it to this e-mail. Can someone tell me if I'm
> doing
> something wrong ?
>
> Thank you for any suggestions help or comments.
>
> Best regards.
>
> Alain Paschoud


__________________________________