akhilskb
Newbie level 4
- Joined
- Apr 20, 2011
- Messages
- 7
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,283
- Location
- Quilon/Trivandrum,India
- Activity points
- 1,334
Attached is a soft UART routine for 16FXXX family. I have tested it and it does function corretly. Coded for a 4MHz OSC, so adjustments must be made for a different OSC frequency. I recommend using the soft UART on the port with the least traffic.
/* Xtal frequency */
#define XTAL 4000000
/* Baud rate */
#define BRATE 4800
/* Transmit and Receive port bits */
#define TxData RA1 /* Map TxData to pin */
#define RxData RA2 /* Map RxData to pin */
#define INIT_PORT TRISA = 1<<2 /* set up I/O direction */
Gokul,
If i get it right, you are using 16F877 which has a single UART and if you are using TX and RX both pins and you connect a GSM. well... you are done with the UART pins and you cannot use it any further for other devices. You can use multiplexing but than thats a different thing.
One more UART... Bit Bang is the option but than needs a bit of coding.
Actually I posted a different version, the complete MPLAB project, with an example app as well on your original thread:
Can i use any other pins for UART in PIC? other than Tx,Rx??
You'll need to change the MCU type in MPLAB.
Set the parameters to match your project's specifications:
Code:/* Xtal frequency */ #define XTAL 4000000 /* Baud rate */ #define BRATE 4800 /* Transmit and Receive port bits */ #define TxData RA1 /* Map TxData to pin */ #define RxData RA2 /* Map RxData to pin */ #define INIT_PORT TRISA = 1<<2 /* set up I/O direction */
And I believe that should do it for you. Let me know if you have any other problems.
---------- Post added at 05:05 ---------- Previous post was at 05:02 ----------
By the way, is your GSM a 5v device? If not you'll need a level shifter between the PIC and the GSM, unless you can run your PIC at 3.3v.
Y should i modify like this? is there any reasons?? And, PORTA is a 6 pin port as i am using PIC16f877a...
Hi guru sir.,
And, is it that., its TRISA = 1<<7 or 1<<2...???
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?