PDA

View Full Version : Serout and 18F87J50



Glenn_Webber
- 8th November 2009, 14:40
Hi,

I need some help. I am trying to get the Serout and Hserout to work on the 18F87J50, I have download many sample code but I can’t get any to work, I am trying to talk to a PC, but I do not what to use a RS232 inverter, It says in the 18F87J50 data sheet, if you set the Bit to 14 and use 115200 then, can talk to the PC and do not need to use any MAX chip,

Dus any one know how to do this, or how can find some code?


Thanks
Glenn

ScaleRobotics
- 8th November 2009, 17:06
Hello Glenn, and welcome to the forum!

With the PIC18f87j50 you have a couple options.

Normally hserout and hserin need a rs232 inverter.... But with that chip you can use the DTRXP: Data/Receive Polarity Select bit to invert your USART port. See http://www.picbasic.co.uk/forum/showthread.php?t=10361

Or, you can use serout driven inverted.

It would help us to know what you have so far, as far as config fuses, and code, as well as mhz, as all your serial settings will depend on this.

Here is a calculator for finding the values to set for baud rate:
http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2957

Glenn_Webber
- 10th November 2009, 10:54
Hi,

First I must say thanks for the quick reply; I have try all speeds from 1200 to 115200 and every setting I can think of. ( Serout Portc.7, 9600, ( and all the rest ), “Hello” and all I get is junk at the PC. ( Unless I use a Max232 ), this is not what I’m looking for.

The circuit is using an TUSB3410, it go’s like this the 18F87J50 pins C7 and C6 go to the TUSB3410 then to the USB on the PC, on the PC we have to use a Ver com port, so I think the problem is setting up the TUSB3410.

Well thanks, if you know any one that has the same circuit and has it working let me know.

Thanks
Glenn

ScaleRobotics
- 10th November 2009, 16:37
I have try all speeds from 1200 to 115200 and every setting I can think of. ( Serout Portc.7, 9600, ( and all the rest ), “Hello” and all I get is junk at the PC. ( Unless I use a Max232 )

Well, you have not really shared many of your settings, or code. But that is promising that it is working with a max232! I assume that "tried Serout Portc.7, 9600, (and all the rest)" means you have tried Serout Portc.7, N9600 (N for inverted)?

Archangel
- 11th November 2009, 04:09
Hi,

First I must say thanks for the quick reply; I have try all speeds from 1200 to 115200 and every setting I can think of. ( Serout Portc.7, 9600, ( and all the rest ), “Hello” and all I get is junk at the PC. ( Unless I use a Max232 ), this is not what I’m looking for.

Hserout / Hserin exchange data TRUE. Serin/Serout may be true or inverted depending upon your selection of T or N example : T9600 or N9600. You may invert the Hserin with a simple transistor, it will not level shift like the max232, but will handle inverted data.

Glenn_Webber
- 19th November 2009, 14:57
Hi,

I need some help. This code works on the 16F690, but will not work on the 18F8722 or the 18F87J50. Can any one help me?

16F690
Pause 500

Serout2 PORTB.5, 84, [$02]
Serout2 PORTB.5, 84, [$61]
Serout2 PORTB.5, 84, [$01]
Serout2 PORTB.5, 84, [$22]
Serout2 PORTB.5, 84, [$06]
Serout2 PORTB.5, 84, [$00]
Serout2 PORTB.5, 84, [$00]
Serout2 PORTB.5, 84, [$00]
Serout2 PORTB.5, 84, [$00]
Serout2 PORTB.5, 84, [$05]
Serout2 PORTB.5, 84, [$00]
Serout2 PORTB.5, 84, [$00]
Serout2 PORTB.5, 84, [$A0]
Serout2 PORTB.5, 84, [$0A]
Serout2 PORTB.5, 84, [$1B]
Serout2 PORTB.5, 84, [$03]

18F87J50 Not working
Pause 500

Serout2 PORTG.2, 84, [$02]
Serout2 PORTG.2, 84, [$61]
Serout2 PORTG.2, 84, [$01]
Serout2 PORTG.2, 84, [$22]
Serout2 PORTG.2, 84, [$06]
Serout2 PORTG.2, 84, [$00]
Serout2 PORTG.2, 84, [$00]
Serout2 PORTG.2, 84, [$00]
Serout2 PORTG.2, 84, [$00]
Serout2 PORTG.2, 84, [$05]
Serout2 PORTG.2, 84, [$00]
Serout2 PORTG.2, 84, [$00]
Serout2 PORTG.2, 84, [$A0]
Serout2 PORTG.2, 84, [$0A]
Serout2 PORTG.2, 84, [$1B]
Serout2 PORTG.2, 84, [$03]

The only biff is the port.

Bruce
- 19th November 2009, 17:50
If you have bit 7 in RCSTA2 set you can't use this pin.

It's configured as the EUSART2 asynchronous receive, and can only receive serial data.

Glenn_Webber
- 20th November 2009, 09:13
Hi,

The above is the full code, I'm new to all this stuff. How do I set the PIN's so I can use it for TX,RX?

Thanks
Glenn

Bruce
- 20th November 2009, 14:26
Can you blink an LED on this pin using the 18F8722 or the 18F87J50?