Show Posts
Pages: 1 [2]
16  Forum 2005-2010 (read only) / Syntax & Programs / Re: interrupt and millis, have questions on: November 28, 2010, 06:01:53 pm
Thanks for your reply, but I'm confused, in the second sentence you say that polling the pins will seem like an eternity, the in the last sentence you say it turns out that it isn't fast enough.

I looked at the link you included, about Port Manipulation, looks interesting, but I don't have enough C programming experience to try it, especially after reading the warnings on the page about using it and debugging. But thanks for the pointer. Maybe when I get a little more confidence in my programming skills.

As I said, I can build a different wheel that will output fewer pulses per revolution, and I was only planning to poll one sensor at a time, then compare values.

Does that make a difference in your suggestions?
17  Forum 2005-2010 (read only) / Syntax & Programs / Re: interrupt and millis, have questions on: November 28, 2010, 05:14:20 pm
Thanks for the quick reply!
Link to?
The encoder

The shade motor

I can always make my own encoder wheel, having say, 4 cutouts to cut down on the number of pulses per rotation.
I was also thinking I could glue 4 magnets on the rollers and use a hall effect sensor.
18  Forum 2005-2010 (read only) / Syntax & Programs / interrupt and millis, have questions on: November 28, 2010, 04:54:57 pm
Hi all!
I'm working on a project where I am working on hooking up three encoder wheels to monitor three roller shades driven by one motor.

I want to have the encoders count several times over a specific time range and compare the three counts.

I would like to repeat this action for 20 or so seconds, if during the time the counts are off by more than 1 or 2 (one encoder might start high, while another is low) I want to trigger a relay to open (this bit isn't an issue).

The three roller shades are connected together using two gearboxes between them, my friend spent a fortune getting the boxes made and they are too "fragile", once in a blue moon one will break and the shades will hang and rip, hence me building a little device to monitor the three rollers for him.

The average travel time is 20 seconds down and 20 seconds up, so during that time I want to watch their rotation speed to be sure they all match (they rotate at 20 RPM), I was looking at a sensor like the Cytron encoder from RobotShop, but others may be used.

I'm thinking a function that is called when the down or up is triggered on the shades, and if the counts are too far off when comparing, I kick the stop relay.
Does all this make sense?

My issue is that I'm looking at the interrupt and millis routines, and I see that the millis routine won't run when using and interrupt.

I was planning to:
1. monitor the pulses from encoder A over x time (millis) & store value
2. then encoder B over same range & store value
3. then encoder C over same range & store value
4. Compare the counts, if in tolerance repeat, otherwise kick the stop relay.

If Millis doesn't work during an interrupt, this course of action seems out the window.
Am I right? About it not working?

Then it dawned on me that there isn't a way to say (Xcount == Ycount == Zcount within 3) to see if we have a shade that is hung.

Or is there?
19  Forum 2005-2010 (read only) / Syntax & Programs / Re: Read and set constants in setup? on: October 31, 2010, 03:36:39 pm
You are right, I only asked if it was possible  smiley

Someone else is asking about part numbers.

I'm going to use 10 position BCD encoded switches.

Obviously, I'll use 7 of them, multiplex the inputs so I'm not eating up 29 pins just to get setup info.
Life should be good after that. ;D
20  Forum 2005-2010 (read only) / Syntax & Programs / Read and set constants in setup? on: October 31, 2010, 02:40:06 pm
I've been searching the forums and found something close (DIP Switch 8 Position to address Sensor), but not quite there, I'm looking for a definite confirmation that this is possible.

I'm planning to use rotary dip switches to set a couple of values, first value is to be 0-999, the second and third 0-99.

My question is, can I put the routine to read the switch hex values, convert them to decimal, and set the values to constants in the setup portion of the program?

I then intend to use those values in the LOOP portion of the program.  They only need to be read once when the system is first powered up.

Does this make sense?
21  Forum 2005-2010 (read only) / Troubleshooting / Re: Multiple steps during function on: November 30, 2010, 04:59:48 pm
Thanks for the quick replies, but I reuploaded and now it works.
Really don't know what is going on, I tried it 30 or forty times, works every time now.
Even reupped again to be sure, still working.
It is running on a Gator+, thats why the LED statements are backwards.
It also has a funny upload procedure, all I can think of is maybe I messed up on the timing.
Got me, thanks again.
22  Forum 2005-2010 (read only) / Troubleshooting / Multiple steps during function on: November 30, 2010, 04:33:54 pm
OK, I'm sitting here scratching my head.

I have a function that I am testing little by little.
I'm adding one piece at a time and testing, this one has me stumped.

If I have ONE thing happen in the function, LED OR relay, it works, if I have them both the relay goes but not the LED.

The relay is an Elexol LV relay interface board, TTL interface.
////// Name function Open Door
///// Explanation
void openDoor()
  int door1Status = digitalRead (14);
  int door2Status = digitalRead (15);
  int door3Status = digitalRead (16);
  int openDoorActuator = 23;
  int errorLED = 13;
  digitalWrite (openDoorActuator,HIGH);
  digitalWrite (errorLED,LOW);
  delay (1000);
  digitalWrite (errorLED,HIGH);
  digitalWrite (openDoorActuator,LOW);
 Serial.println("------Open Door Function Run-------------");



Any ideas??
One or the other, yet the serial print line data comes back to the screen every time.
I'm stumped.
23  Forum 2005-2010 (read only) / Development / Re: Cascaded shiftin skips first zeros? on: November 09, 2010, 11:36:13 pm
OK nevermind, it only skips when printing to screen, when I put the data in an array and they retrieve it it is all there.
24  Forum 2005-2010 (read only) / Development / Cascaded shiftin skips first zeros? on: November 09, 2010, 06:51:24 pm
Hey all,
I've been searching the forums and can't find an answer to this issue.
I'm thinking I'm doing something stupid, but you know you never find it till you hit post.

I am going through the shiftin tutorial and have added a third 4021 to read the status of three 8 position dip switches.

I can read all three, but if the second or third has any of the switches off as you read from 0-7, the returned data ignores those and just shows the 3rd, 4th, or whatever starting first bit is on.

So I can get all 8 bits on the first 4021, then depending on the settings I'll get 4 or 5 bits and sometimes a single 0 if no switches were set on the others

I am planning to read each of the switches 8 bits and assign values in a program based on the settings, but I am trying to use each of the 4021's to read two 4bit values.
Does that make sense? The first half of 4021 A is one value while the second half is another value and so on for 6 value settings altogether.

Skipping initial 0 inputs on 4021 b & c won't work.

Also, while I'm here, I want to read the 1's and 0's of each bit and convert to a decimal number then do some fancy math.

So I need to read all 24 1's and 0' then break into 6 values, can someone point me at a way to pick out each bit and convert it?
In reading through the forums, I'm thinking the next tutorial should be getBit().

Am I going in the right direction there?
Pages: 1 [2]