This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interfacing CD4052 with 2 uarts in 8051

Hey all,

I am doing a project on Vehicle Tracking System using GPS and GSM Modem.The 2 devices aforementioned communicates with 8051uC. But since there is only 1 UART in 8051 i have to use a analog multiplexer i.e CD 4062. I want to know how to interface it with GPS, GSM, and 8051.

Also it would be grateful if anyone could tell me how to parse output of GPS and how initialize a GPS receiver to that it starts giving me the GPRMC

Parents Reply Children
  • Remember that nobody here knows anything about you, your background, or your experience other than what you tell us in your posts.

    If you tell us in one post that you are familiar with the 8051 architecture, but then say you don't know what XRAM and MOVX instructions are - what are we supposed to think??!

    "the doubt was if its external memory how is it ON CHIP"

    I that was your specific doubt, why did you not ask that specific question?

    Again, are you really telling us that you are familiar with 8051s, but have never come across one with on-chip XRAM?

    I think you need to explain exactly what "experience" you have had with 8051s - otherwise, how can we tell how to answer you appropriately??!

  • Let us put all of my above statements into a bin.
    I'll start from the scratch.

    1)Well, I know a lot about 8051(I have covered all chapters of Mazidi).The reason for not knowing anything related to ON CHIP XRAMs is that I've been using AT89s52 which has 256bytes of internal RAM and 8K Bytes of In-System Programmable (ISP) Flash Memory. No uC other than this for my projects(As part of my syllabus I've done PIC18F family too).

    2)Currently as my Final Year of BE project. I took Vehicle Tracking System using GPS and GSM modem.
    I know that GPS outputs in NMEA format and GSM modem works on AT commands.

    3)The Reason why I am keen on using 8051 family is that I am adhered working with 8051.It has been a part of my projects.So i am quite acquainted with it.

    4)Currently my doubt is that the RMC data available would be of this format " $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598, ,*10" It contains many information.If i recieve each bit(through my RXD pins). Would i save in the data registers or in the memory.

    5)I've posted the above information assuming that all the previous posts by me is just thrown off into a bin.

    PLS HELP.

  • Would i save in the data registers or in the memory
    Make an attempt to code the serial, if "I have covered all chapters of Mazidi" is true and 'covered' does not mean "read but did not understand" you should be capable of getting very close. When that is done you have the answer to the above.

  • Ill definitely work that out. Would be a little away for sometime till i get the answer. ill reply back soon

  • Good idea.

    Probably best to start a new thread - with a link to this thread, and a summary of what you've learned.

    "8051 ... has been a part of my projects. So i am quite acquainted with it."

    Don't get a false sense of security about that: your experience, apparently, amounts to just one specific chip, and one rather outdated textbook - it's a start, but you still have much to learn.

    See: www.8052.com/.../175896
    And: www.8052.com/.../175610

    Your first step is to learn how to use the UART(s) on your chip to do serial comms. As already noted, there are plenty of examples of that on this site, the Atmel site, and many other places on the web.
    It should also feature in any book on the 8051.

    A useful site for finding source code is http://codesearch.google.com

    "Would i save in the data registers or in the memory"

    Are you planning on programming in 'C' or Assembly?

  • As you know, the processor has a limited number of registers. Even if you combine all register banks, it's not enough for a full $GPRMC string.

    So you then have two options - already covered earlier in this thread:
    - process the data one byte at a time directly when receiving the characters. Store state machine state and decoded field data in variables.
    - store a full line of text in a character array. Then decode it.

    Decoding of the data is done almost identically whatevery processor or computer language you are using.

    Note that NMEA is a protocol standard. But that doesn't mean that you can't find GPS modules that supports or uses other protocols. And not all GPS modules supports all NMEA strings. More importantly - different modules emits different sets of NMEA strings default when powered up - you may need to send an init string to the module to change the set of NMEA strings it should emit - and what frequency the GPS should use for the individual strings. That means that you need the manual for the selected GPS. Don't ever get a GPS without already having access to a good manual. The same, obviously, goes for the GSM module - you may need to use manufacturer-specific AT commands. And their existence requires you to have the AT protocol documentation.

  • Here what I got for the 20 Channel EM-406A SiRF III Receiver with Antenna GPS module.
    Here is the link : www.sparkfun.com/.../product_info.php

    What should I look in manual for selecting whether the GPS module is good or not.

  • FIRST get the serial going

    do ONE thing at the time, do NOT jump all over the place

    Erik

  • Remember: on an 8051, there is no such thing as just, "the memory".

    The 8051 has several different memory areas - DATA, IDATA, XDATA, etc...

  • Why do you think this world has so many different GPS modules? Every customer has his own needs.

    Only you know what parameters are important to you. That was why I did post a short list of parameters to think about. There are more parameters too:
    - type of connection (surface-mounted, pin header, bluetooth, ...)
    - price
    - availability
    - availability of good documentation
    - temperature range (industrial, automotive, military, ...)
    - civilian or military (max speed, height, jerk, ...)
    - fully intelligent GPS or using your processor for the computations.
    - support for real-time GPS correction.
    ...

    The list can be made almost infinitely long.

    You must make the requirements list.

    You must give different requirements different weights.

    You must figure out which GPS gets best score.

    My "best" GPS is not your "best" GPS.

    For a school project, it's enough that it uses supply and signalling voltages you are able to interface, a connector you are able to interface to, and the ability to detect satellites in the environment you are going to demonstrate the design in. All else are just optional extras. If you have special goals with your project, then you obviously have to bring in more parameters when scoring the GPS - we don't know what these parameters may be because we don't know your goal.

  • There are more parameters too

    and a very important one if you plan to use it downtown

    dead reckoning

    downtown you will be lost without it

    Erik

  • I'm basically planning to write C program and in some parts combining with the assembly too.
    i.e 1)Inputting the data and processing it(Byte manipulation)i think i would do in C eg String comparison by strncmp(). u would have got an idea.

    2) Bit manipulation such as SETB PSW.3 CLR PSW.3
    I Intend to do by Assembly, Creating delays (since assembly provides exact delays using Timers)

    Hence my program would be a combination of C and Assembly

  • Yes, it's good to use both 'C' and assembler for their particula advantages - but the 2 examples you gave don't actually require assembler!

    "2) Bit manipulation such as SETB PSW.3 CLR PSW.3"

    There is no need for assembler there - Keil C51 can do that perfectly well.

    See: http://www.keil.com/support/man/docs/c51/c51_extensions.htm

    "assembly provides exact delays using Timers"

    Assembly has no particular advantage when using the hardware Timers - because it's the hardware that controls the timing, not the software.

    It's when you're trying to do software delay loops that you need assembler...

    See: www.8052.com/.../162556

    (note that software delays are not generally a great idea)

  • Yes, that'd be an appropriate place to use 'C'.

    But note that writing in any High-Level Language (HLL) means (among other things) that you delegate use & control of the CPU registers to the compiler.

    So this answers your earlier question about using registers or "memory" (sic) for your data...

  • I usually do my projects(or would say have done my projects)in ASM.I would be doing embedded C for the first time. I went through all the examples from Mazidi.Now I can even write my programs in C(In fact it makes work lot easier).
    But when it comes to wwriting C and assembly together I'm stuck. I went through the tutorial at :www.8051projects.net/.../mix-c-and-assembly.php

    I wasnt able to understand a thing.
    Can u all post a link from where I can learn mixing C and assembly.Or any book u can suggest.Regarding books I've downloaded " Embedded C :Michael J. Pont"
    Pls help