Here pic16f877a parallel digital input convert to series output

Discussion in 'Embedded Systems and Microcontrollers' started by kasun1993, Jun 13, 2016.

  1. kasun1993

    Thread Starter New Member

    Jun 13, 2016
    8
    0
    tried with mikroc,, 4 digital inputs was given to the porta of pic by pullup resistor,,,that digital inuts must be get out from portc pin 1 one after another with 100ms delay,,,, hope for the mikroc code
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Hi kasun, welcome to the forums.

    We would need a bit more information to even begin to help you, like what is this serial out? What format?

    Reading ports is easy, there are a few tricks like you need to turn off any associated analog functions which are on by default.

    A dumb delay is simple as long as you have nothing else to do in the meantime.

    Last, we don't write code for you. We will help guide you to your solution.

    Hope to hear back from you!
     
    kasun1993 likes this.
  3. kasun1993

    Thread Starter New Member

    Jun 13, 2016
    8
    0
    [​IMG] [​IMG] Thank you,, Here I have attached simple diagram of my project,, I can give +5v or 0v by x,y switches to RA1 and RA2 pins,,after giving that values,, when switch on the "P" switch,,,, at first the digital value of RA1(5v or 0v) must come out from RA3,, after 1 second digital value of RA2(5v or 0v) must come out from RA3,,, the procedure is it,,can you give a idea how do it do with mikroc ,,, it will great help
     
    • ttt.jpg
      ttt.jpg
      File size:
      77.5 KB
      Views:
      5
  4. kasun1993

    Thread Starter New Member

    Jun 13, 2016
    8
    0
     
  5. kasun1993

    Thread Starter New Member

    Jun 13, 2016
    8
    0
    [​IMG]

    Click this image to show the full-size version.
    [​IMG] Thank you,, Here I have attached simple diagram of my project,, I can give +5v or 0v by x,y switches to RA1 and RA2 pins,,after giving that values,, when switch on the "P" switch,,,, at first the digital value of RA1(5v or 0v) must come out from RA3,, after 1 second digital value of RA2(5v or 0v) must come out from RA3,,, the procedure is it,,can you give a idea how do it do with mikroc ,,, it will great help ttt.jpg
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    I am confused with how many inputs you use, 4 or 3 or 2. But the same holds for any number.

    You start by initializing the device for port A, turn the analog functions off using CMCON, use TRISA to set RA3 as an output (they start as inputs).

    Read the first port pin and set RA3 to that value. Wait the one second, read the next pin and again set the output.

    Do try to read the data sheet for the port register. I do not know of they have a translation for you. Same with the compiler manual.
     
    kasun1993 likes this.
  7. kasun1993

    Thread Starter New Member

    Jun 13, 2016
    8
    0
    ok I will try with your option,,,tnx
     
  8. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,694
    904
    Why not copy the whole port, then shift out (i.e., send sequentially) as a usual serial transmission? That way, there is no chance a pin value will change while waiting. We don't know whether the TS wants 4-bit or 8-bit serial.

    John
     
Loading...