Page 1 of 1
18F6722 RS232 flow control, is this a bug?
Posted: Thu Jul 08, 2010 12:10 pm
by Ondra
Good day all. I design a circuit that requires RG4 and RG3 be used as RTS and CTS flow control. Under properties for the RS232 component
I don't have G as an optional port. The board for my circuit is already done. Is there a way I can use the G port for my flow control pins?
Thanks in advance.
Ondra
Re: 18F6722 RS232 flow control, is this a bug?
Posted: Thu Jul 08, 2010 1:20 pm
by Albert38
The 18F6722 has two EUSART's EUSART1 is on port RC6 (RX) and RC7 (TX) EUSART2 is on port RG1 (RX) and RG2 (TX)
If you want to use flow control you are able to select any pin of the ports A-E The flow control pins are user selectable.
Re: 18F6722 RS232 flow control, is this a bug?
Posted: Thu Jul 08, 2010 2:11 pm
by Ondra
When I designed the board I used G3 and G4 for my flow control pins. Is there no way to access them, maybe by changing the FCD file for that chip and if so, what and where do I make the changes?
Ondra
Re: 18F6722 RS232 flow control, is this a bug?
Posted: Thu Jul 08, 2010 3:11 pm
by Benj
Hello Ondra,
Yes this is a bug with the RS232 component properties not allowing any ports past PortE.
To get around this you can use the code customisation feature.
Select the RS232 component and then click the edit code button,
Select the Defines code section and click edit.
Find the following lines in the defines section.
Code: Select all
#define %m_RTS_PORT %a
#define %m_RTS_TRIS %b
#define %m_CTS_PORT %c
#define %m_CTS_TRIS %d
#define %m_RTS_PIN %e
#define %m_CTS_PIN %f
Then change these to make them relevant for your hardware. eg.
Code: Select all
#define %m_RTS_PORT portg
#define %m_RTS_TRIS trisg
#define %m_CTS_PORT portg
#define %m_CTS_TRIS trisg
#define %m_RTS_PIN 4
#define %m_CTS_PIN 3
Note that you will still have to enable the flow control in the component properties. The port and pin values shown in the properties page will be overridden by your values.
Re: 18F6722 RS232 flow control, is this a bug?
Posted: Fri Jul 09, 2010 11:10 am
by Ondra
Hi Benj.
I spent the better part to the day trying to get the USART 2 working with now success. I tried Receiving without using flow control and had no success. Using a scope I can see that the data is at the pin. At 9600 the bit width is .11ms. I think there maybe more issues with USART 2 on this PIC, could it be that the inability to select the G port for flow control also goes for the TX and RX as well? Could someone have a look at this? It's got me at a stand still. Thanks in advance.
Ondra
Re: 18F6722 RS232 flow control, is this a bug?
Posted: Fri Jul 09, 2010 12:06 pm
by Ondra
OK. forget about what I said earlier. I got it working. Oscillator was set to HS-PLL I set it to HS and it worked.
Ondra
Re: 18F6722 RS232 flow control, is this a bug?
Posted: Fri Jul 09, 2010 12:14 pm
by Benj
Hi Ondra,
Phew, you had me a bit worried there for a minute. Thanks for letting us know the problem is resolved.