CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem reading parallel inputs in

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Maqhawe



Joined: 04 Jul 2011
Posts: 2

View user's profile Send private message

Problem reading parallel inputs in
PostPosted: Mon Aug 08, 2011 4:14 am     Reply with quote

Hi there

I am fairly new to C programming and I need help in designing a program that will read 4 parallel inputs and ensure that they are incrementing sequentially. That is from 0000 to 1111.

If I may add, I am trying to test the functionality of a 4-bit absolute encoder. So my plan is to design a sequential test using a PIC18F4525 to achieve this.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Aug 08, 2011 2:22 pm     Reply with quote

Do you have any sort of strobe signal that tells you the pins have changed? If not you just have to keep reading and subtract the "old" value. If the result is 0 nothing has changed. If the result is 1 then they have incremented and you have a new "old" value. If the result is anything else you have an error, though if it is 2 or 3 you may have just missed a count or two.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Maqhawe



Joined: 04 Jul 2011
Posts: 2

View user's profile Send private message

PostPosted: Tue Aug 16, 2011 8:48 am     Reply with quote

thanks SherpaDoug

I have taken your advice into consideration and now Implementing it in code
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group