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

Easy program but need help about toggle input

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



Joined: 07 Aug 2010
Posts: 4

View user's profile Send private message

Easy program but need help about toggle input
PostPosted: Sat Aug 07, 2010 8:25 am     Reply with quote

Hi all,
I'm the beginner of PIC MCU and C also.
I want to make a circuit it's call auto-up/down car window.
- two inputs
- two outputs
- one current sensor (currently not implement yet)

The idea for this is when user push down or up switch the input of this circuit will receive Hi:Lo or Lo:Hi depend on up or down.

When the mcu detect that signal it will count for judge the mode for operation.
If signal is come less than 0.5 sec it will judge it's automatic mode.
Then the mcu will output Hi:Lo or Lo:Hi till the current sensor detect the overcurrent signal. When detected the mcu will stop the output immediately.

But if signal come longer than 0.5sec it judge to manual mode and it will output signal depending on input (if user release button the output will stopped).

So I try to study the PIC and C for do that.
I write below code it's almost satisfy but some problem still occur and I can't fix them.
I need your help on this.
1. Currently the count time not exactly.
2. When it's in automatic mode I want to stop the window by pressing the opposite side key (currently it's not stop but working in opposite direction).
Code:

ignore

Thank you.
Sorry for my poor English.


Last edited by rockuup on Mon Aug 09, 2010 7:07 pm; edited 1 time in total
rockuup



Joined: 07 Aug 2010
Posts: 4

View user's profile Send private message

PostPosted: Mon Aug 09, 2010 10:53 am     Reply with quote

Can anybody help me? Please!
I need only when press other button in other mode it will stop output.
please help me to revise the code.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Aug 09, 2010 11:16 am     Reply with quote

Most people don't want to look at your code for these reasons:

1. The formatting packs too much code on each line. I think most
people want to look at a more conventional coding style. We don't
want to have to struggle to understand the code.

2. You've dumped a whole program on us, instead of just a little
aspect of it. You've made a program that you don't understand
(that's difficult to read) and you want us to fix it.
rockuup



Joined: 07 Aug 2010
Posts: 4

View user's profile Send private message

PostPosted: Mon Aug 09, 2010 7:06 pm     Reply with quote

PCM programmer wrote:
Most people don't want to look at your code for these reasons:

1. The formatting packs too much code on each line. I think most
people want to look at a more conventional coding style. We don't
want to have to struggle to understand the code.

2. You've dumped a whole program on us, instead of just a little
aspect of it. You've made a program that you don't understand
(that's difficult to read) and you want us to fix it.

Thank you for your comment. I will try to do better in the next time.
Currently I'm newbie for both PIC and C language programming.
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