RF tranceiver code

Discussion in 'Embedded Systems and Microcontrollers' started by pancikok, Mar 17, 2011.

  1. pancikok

    Thread Starter New Member

    Oct 31, 2009
    26
    0
    Hello,
    Im working on RC car project, actually i try to work, things are not so good for now!!
    anyway, i need to understand how actually the data is gathered from joystick and passed to transmitter!I want to use 2 one directional joysticks, one for forward-backward and one left-right. But i cant understand, how the data is taken from joystick in code, should there be a loop waiting for all data to be gathered bit by bit?!?!? give me some clues, maybe some little code, doing the simple input of a byte?!?!?!

    Thanks a lot, Hafiz Hasanov
     
  2. RRITESH KAKKAR

    Senior Member

    Jun 29, 2010
    2,831
    89
    Hi, have you made it mechanical model??
    & you can use HT 12E/D with Rx/ Tx.
     
  3. pancikok

    Thread Starter New Member

    Oct 31, 2009
    26
    0
    What do you mean by mechanical model?!?! physically i havent constructed the circuit yet, im waiting for the parts to arrive ,but dont want to waste time!
    You mean, instead of pic-s i should use HT 12?!?! But the sole purpose of my assignment revolves around pic programming!! i have had programmed only basic programs(led flash), but this is more coplex!!! and i have to do it with pics
     
  4. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
    Hello,

    There are different types of joysticks.
    The "mechanical" ones use only some microswitches for the directions.
    This will only give an on/off signal.
    The analog ones use potentiometers for the position, and will be continuous.

    Bertus
     
  5. pancikok

    Thread Starter New Member

    Oct 31, 2009
    26
    0
    Hello, Bertus

    Haa, now that was meant to be mechanical! well, i guess i would be using Analog ones. But two of them, one for only x axis, and another for y axis!!!
    Now the point is, if it would be continuous input, so in code, i need to continuously listen to the input port?!?! lets say portB RB0 pin! would the position of potentiometer be connected to only one input pin of PIC and read until the end of data or what?

    i am not planning to put speed control, so basically i need just forward and backward, if i can do that i can do the left right too! so, some position of potentiometer would be forward, other backward and in between stop!
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
    Hello,

    Depending on the type of pic you use, you will have several ADC's in it.
    The joystick van be connected to ground and powersupply,
    you can read the analog voltage from the joystick.
    You will need a routine that checks the ADC-values from time to time.

    Bertus
     
  7. pancikok

    Thread Starter New Member

    Oct 31, 2009
    26
    0
    I was planning to use PIC16F84,but it seems it hasn't any ADC! so maybe i use pic16f628?!?! and also, i m coding in assembler, and the convertion is supported by PICbasic as i understood!!!
     
Loading...