Hi
Is possible to modify the PIC_GSM.c so that the RTS and CTS ports can be selected. (Like in the PIC_RS232.c you can select different ports/pins for the RTS & CTS).
At present you can select the pin number of the UART port for RTS and CTS, but you cannot change it from the UART port (C in my case)
The reason is that on the port C I need to use the T1OSC (2 pins) , and the SPI (3 pins) and UART (2 Pins). This only leaves one spare IO on Port C, so I will have to move RTS & CTS to Port A or B
Regards
Andrew
GSM RTS CTS Port selection
Moderator: Benj
-
Gary Freegard
- Posts: 45
- Joined: Mon Nov 07, 2011 6:36 pm
- Has thanked: 1 time
- Been thanked: 30 times
Re: GSM RTS CTS Port selection
Hi Andrew
If you look at the datasheet for the Pic you are using, you will find that the hardware UART (RS232) are wired to these pins. The only way to use other pins is to use software based UART, see link.
http://www.datadog.com/software_uart.pdf
Hope this helps
Gary
If you look at the datasheet for the Pic you are using, you will find that the hardware UART (RS232) are wired to these pins. The only way to use other pins is to use software based UART, see link.
http://www.datadog.com/software_uart.pdf
Hope this helps
Gary
- Steve
- Matrix Staff
- Posts: 3434
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: GSM RTS CTS Port selection
To change the CTS and RTS pins, you can edit the C code file for the GSM component (in the "components" directory of Flowcode). Basically, you will need to search for all occurrences of "GSM_232_RTS" and "GSM_232_CTS" and change these lines accordingly.
For example, the line:
will need to become:
To make this easier, you may want to set up a few defines for the PORT/TRIS for the CTS and RTS pins in this C code file. This way, you will only need to alter one line if you change your mind about which port you are using.
Note that the following code will probably need to be removed too:
But looking at the code for this component, it seems that CTS is not used anyway.
For example, the line:
Code: Select all
clear_bit(MX_UART_TRIS, GSM_232_RTS); //RTS is an outputCode: Select all
clear_bit(<tris register for RTS>, GSM_232_RTS); //RTS is an outputNote that the following code will probably need to be removed too:
Code: Select all
#ifdef GSM_232_HARDWARE
#if(GSM_232_RTS == MX_UART_TX)
#error RTS is set to TX pin
#endif
#if(GSM_232_CTS == MX_UART_TX)
#error CTS is set to TX pin
#endif
#if(GSM_232_RTS == MX_UART_RX)
#error RTS is set to RX pin
#endif
#if(GSM_232_CTS == MX_UART_RX)
#error CTS is set to RX pin
#endif
#endifRe: GSM RTS CTS Port selection
Thanks for the replies.
I will setup some custom code to rearrange the ports as described, or remove the CTS from the C code and use the last remaining pin on port C for the RTS
Regards
Andrew
I will setup some custom code to rearrange the ports as described, or remove the CTS from the C code and use the last remaining pin on port C for the RTS
Regards
Andrew