GSM RTS CTS Port selection

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Been thanked: 8 times

GSM RTS CTS Port selection

Post by cruzxia »

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

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

Post by Gary Freegard »

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

User avatar
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

Post by Steve »

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:

Code: Select all

		clear_bit(MX_UART_TRIS, GSM_232_RTS);      	//RTS is an output
will need to become:

Code: Select all

		clear_bit(<tris register for RTS>, GSM_232_RTS);      	//RTS is an output
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:

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
    #endif
But looking at the code for this component, it seems that CTS is not used anyway.

cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Been thanked: 8 times

Re: GSM RTS CTS Port selection

Post by cruzxia »

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

Post Reply