Pic24f04ka201

Discussion in 'Embedded Systems and Microcontrollers' started by adulfo, Feb 10, 2010.

  1. adulfo

    Thread Starter New Member

    Feb 10, 2010
    6
    0
    I have this project using this PIC24F04KA201. I have two inputs coming from two sensors, temp and load cell. I want to acquire the two data via serial port(RS232) to be plotted using MATLAB. This project is all about getting the moisture content of the soil using an oven that is controlled by the MCU, only on and off of the oven. The host computer will send first a command to turn on (and off if the weight becomes constant) the oven via a relay connected to one I/O pins of the MCU. Now, can somebody help me in writing the sequences of the codes, from 2 channel ADC to transmitting and receiving via UART.
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    The simplest method will be to send the numbers to Matlab as 16 bits data. Then do all the scaling in Matlab. I often do this kind of work in Labview no problem at at all. Just remember to get the correct byte order (little/big Endian)
     
  3. adulfo

    Thread Starter New Member

    Feb 10, 2010
    6
    0
    My problem is in programming the PIC, maybe it is a little bit easy in MATLAB. But thank you for your advice. I will just post my codes later. AU.
     
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Your CPU is quite powerful and since I guess your samplerate will be relatively low. You will have more than enough time to do both calculations and formatting in your MCU. But one thing you should emphasise on, is the data transfer protocol. This should be made so you can send simple commands to the MCU, like start sampling, stop sampling, and change samplearte as some examples. And also be able to detect error. Like that you miss a byte for some reason.
     
  5. adulfo

    Thread Starter New Member

    Feb 10, 2010
    6
    0
    Thanks. I will just send my codes as Im going on programming.