Here pic16f877a parallel digital input convert to series output

Thread Starter

kasun1993

Joined Jun 13, 2016
8
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
 

ErnieM

Joined Apr 24, 2011
8,377
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!
 

Thread Starter

kasun1993

Joined Jun 13, 2016
8
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
 

Attachments

Thread Starter

kasun1993

Joined Jun 13, 2016
8
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!
 

Thread Starter

kasun1993

Joined Jun 13, 2016
8


Click this image to show the full-size version.
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 helpttt.jpg
 

ErnieM

Joined Apr 24, 2011
8,377
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.
 

jpanhalt

Joined Jan 18, 2008
11,087
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
 
Top