Discussion in "Project Help" started by    mhmd_saud    Nov 11, 2009.
Fri Mar 26 2010, 05:10 pm
you can use a multiplexer/de-multiplexer e.g CD4052 to switch between two uarts...
Mon Mar 29 2010, 04:26 pm



There may be simpler way in this case.
I think the PIC only needs the receive data from the GPS and only needs to
send data to the modem.
You could use the PIC's one serial port for both.

The PIC doesn't need to see the responses from the modem once everything
is tested and working.
During testing you could use a switch to select input from the GPS or modem.

ExperimenterUK



Is that possible? I can just program it the usual way and use 1 serial port for both?
Mon Mar 29 2010, 08:19 pm
for that use the method i posted, use a Mux/Demux.
Mon Mar 29 2010, 09:13 pm
Ohh CD4052 ey?
Will that require any programming too?
I'll just need that during the testing right?
Tue Mar 30 2010, 05:26 am
I think software USART using is the best way. It is so easy in PIC BASIC OR PROTON BASIC


[ Edited Tue Mar 30 2010, 05:29 am ]
Wed Mar 31 2010, 12:26 am
>Will that require any programming too?
a little bit of programming, you need to make proper selection of selector pins A,B,C to select uart you want to work with.

>I'll just need that during the testing right?
what that means? this should be a part of your hardware if you are muxing uarts.
Wed Mar 31 2010, 04:40 am


>I'll just need that during the testing right?
what that means? this should be a part of your hardware if you are muxing uarts.

Ajay Bhargav


I think VioletRock was referring to my idea of just transmitting to the modem and just
receiving from the GPS.

@VioletRock
There are several options for you to think about.
You don't need to send anything to the GPS so you don't need a TX connection
for that.
Once ready for use, I don't think you need to receive from the modem if you only send
position updates at fixed intervals.

Basically the SMS messages will either be sent or will fail, there will not be much
your transmitter can do about it.
In this case you only need one TX pin and one RX pin and your single UART can
provide both.

If you want to monitor all modem responses or receive SMS messages you will need
to be able to receive from two sources (modem and GPS)

There are two choices.
1:
Create a second serial port using software,connect the output of the modem or GPS to a
pin on the PIC and write a program to monitor its level.
Then convert on off pulses into characters.
This in known as a software UART.

2:
Switch the output of the modem or GPS into the USART RX pin using
either a chip such as the CD4052 or a relay.


[ Edited Wed Mar 31 2010, 04:41 am ]
Thu Apr 01 2010, 08:23 pm
hey, I'm using MikroC PRO to program the PIC.
Do u guys know the header file for programming the UART?

Coz I'm trying to test program using the UART example :

char uart_rd;

void main() {
ANSEL = 0x06; // Configure AN pins as digital
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;

UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize

UART1_Write_Text("AT");
UART1_Write(10);
UART1_Write(13);

while (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
}
}
}


and I keep getting error for undeclared ANSEL, ANSELH, etc.
I was told that I have to include a header file before the codes. I have no idea what's the header file, or where I can get it. I've tried googling and all. I'm lost.
Sat Apr 03 2010, 01:40 am
I have attached the header file for a 16F877A.
Unzip it and place it in the same directory as your source file.

Add this line at the start of your program before and definitions equates etc.

#include <16F877A.h>





[ Edited Sat Apr 03 2010, 01:44 am ]
 VioletRock like this.
Sun Apr 04 2010, 01:55 pm
I tried placing it in the same directory, but the error says the include file could not be opened. Where exactly do I place it? My .mccpi file was saved in my documents, does that mean I plac the .h file there too?

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Robertgurse
Wed Apr 24 2024, 02:43 pm
Richardedils
Wed Apr 24 2024, 04:07 am
ChrisLub
Tue Apr 23 2024, 05:21 pm
Davidbab
Tue Apr 23 2024, 10:41 am
Richardrit
Tue Apr 23 2024, 09:54 am
HenryLaf
Mon Apr 22 2024, 03:50 pm
bleradrar
Mon Apr 22 2024, 06:38 am
ppu-pro_ka
Sun Apr 21 2024, 07:39 pm