Searching \ for '[SX] I2C counter OR counter + parallel/serial I2C' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/ubicom/lib/io/index.htm?key=i2c
Search entire site for: 'I2C counter OR counter + parallel/serial I2C'.

Exact match. Not showing close matches.
PICList Thread
'[SX] I2C counter OR counter + parallel/serial I2C'
2007\11\13@101301 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

Fellow SXers;

Do you know if there is an I2C counter OR counter + parallel/serial I2C combination that would do the trick. For arguements sake, lets say it would be 8 bit (0-256), running off 5V. I would like to count the number of pulses from a sensor but I don't want to tie down the Stamp or SX processor.. rather just read the counts in every so often and then reset the counter. Any ideas would be appreciated. John
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@102009 by black68cougarn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, black68cougar wrote:

Just use another SX chip - that is what they are for. I keep seeing request for I/O extenders - Just Use another SX for it.
Isn't that the convept of Virtual Periferals.  The (maybe) small cost difference is easily offset in stocking only a few part types - not having to go look for another part type -
and in tayloring it to just exactly what you want instead of "making something work"
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230553
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@102757 by mgreenn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, mgreen wrote:

There don't seem to be any I2C based counters other than real time clocks, but those won't count external events.
Your best bet would be to use a binary counter chip and an I2C I/O Expander to read it and reset it.

On the other hand, adding a second SX might be simpler as Doug suggests.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230554
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@103539 by beann/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote:

If you're not use RTCC for anything else, just setup RTCC to count from the RTCC pin. It won't slow down the SX at all, plus you can use the prescaler too.

Just ask if you would like to see some example code and I'll whip some up.

Bean.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230557
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@105102 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

The MCP23016 I2C 16 bit expander is about $2 and the SN74LS90D is about $1.65.. SX/28 is $2.79 so it is cheaper. Now I would have to communicate from 1 sx to another.. Is that easy to do?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230560
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@105903 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

Hi Bean.. I'm currently using INTERRUPT 1000  and the Clock/Timer example code with some small mods to multiplex 6 LEDs. Can I count on the RTCC port while I'm doing that?  What about SX to SX communication? Are there any examples on that?

Unfortunately, I can't read my LED display when I go outside in bright sunshine.. so I will have to switch tot LCD displaysfor this project.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230562
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@112441 by beann/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote:

verobel,
 Nah the INTERRUPT will use RTCC. But depending on how fast the input pulse is that are counting you could code a counter as part of the interrupt routine.

 SX to SX communications can be anything from just connecting 8 pins from each device to serial (SERIN/SEROUT).

Bean.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230565
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@114020 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

If the pulse stream from your sensor is at less than 500 Hz you could just scan the sensor pin during the interrupt.  I attached a modified version of the program that will do that  on the rising edge of the sensor input pin.  This is what is meant by "virtual peripheral" -- the program now has two: an RTC/timer and a counter.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230568
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@120655 by Sparks-R-Funn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote:

The SX can also be configured to immediately jump into the ISR when a Port B pin changes to the desired state.  You can then have the ISR check the pin status and the value of RTCC to decide when to update the signal counter and when to process the other interrupt code.

In general, the more specific people are in describing their requirements the more specific the resulting answers seem to be.  In this case, several people have offered different approaches that all seem likely to accomplish your goal.  If any of them are not clear enough, just keep asking questions.

- Sparks
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230575
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@141607 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

Thanks for all the input guys.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230600
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@214431 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

After reviewing Jon's code and considering that I expect pulses in the 0 tot 80 hz range, I think the slower the pulses, the more chance I will have of missing them, unless I set the DELAY_MS value large (say 800), in which case any other code in the MAIN routine might not get executed. Perhaps the external 7490 counter fed back through mcp23016 i/o expander chip would be more fool proof.

I had also thought of just interupting on every pulse and then calculating the time between pulses...but I needed the timer code for that and apparently RTCC is already in use.

The extra (independant?) counters on the SX48 sound promising but I don't have any of those chips and they don't seem to come in DIP form so how would I test stuff out on my PDB/breadboard?

Is there an 7 seg LED that is bright enough to be seen in daylight?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230673
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\13@215527 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

I'm confused as to why you think you'd miss pulses.  At 80 Hz -- assuming a square wave from your sensor -- you'd get 6.25 interrupts per input pulse.  The VP as designed is simply a counter that will increment on pulses; you clear it when you want to restart and then read it after some specified period.  Remember, you're also running at RTC VP so you could use that for timing.  And if you need more counts, but the value for the sensor to a word.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230676
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\14@043019 by beann/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote:

John,
 It really hard to suggest things when we don't know what the sensor signal looks like.

 What is the sensor ? What does it's signal look like.

 Like Jon, I don't understand why you are so intent on adding extra hardware. I'd bet you a doughnut that the SX28 can do it, but we need to know exactly what the signal looks like to help you.

 The whole idea of the SX is that it can most things without adding extra hardware.

 If you think you will miss the pulse because it is very quick, you can use the edge latches on the portB pins. The port B pins can be setup to capture rising or falling edges. So if you get a quick rise and fall while the program is doing other things, the latch will still be set so you KNOW a pulse happened and it won't be missed.

Bean.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m230702
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\15@122718 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

Hi Bean & Jon; (thanks Sparks..for ideas)
The sensor is Melexis 90217 from Parallax (magnet detection). It is mounted on a 27"
bicycle wheel near the central bearing. There are 2 magnets 180degrees apart provide
2 pulses per revolution. I don't know what the signal looks like but I speculate that
it is like a square wave with a 20% duty cyle. (as long as the magnet is in range the
pulse stays high?).

I wouldn't say that the pulses are quick, just that if they come at
the wrong time ( when interupt is running, and it runs alot ) the SX28 could miss them.

I was thinking I would miss pulses because the SX/28 could not detect pulses while it
was busy on the interupt routine. But looking at your code again, it looks like the SX
can latch a pulse, while other code is running. Then, as long as some code 'counts' the
pulse and resets the latch before the next pulse arrives, it should work ok. That code
is DELAY_MS.

If I understand Jon's extra code, it looks like the MAIN program should loop, updating
display LEDs values while the interupt routine multiplexes the display cathodes.
The MAIN calls DELAY_MS at some unknown interval ( when interupt is not running and other
code in MAIN is not running). During that time 'JNB isrFlag'
would check if say RB.0 is high and then branch somewhere where a counter could be
incremented. That counter could be inspected every so often in the main program, used
in a calculation and then reset. This seems to require input RB.0 be set to act like
a latch? I think I just need some help mixing some assembler code in SX/B to get the
job done.

respectfully, John ps. Bean, I like the idea of doing as much as possible on one SX/28 chip (for this project)
to keep the parts count and cost as low as possible. Just show me how..

ps. Jon, If the pulse stayed high long enough wouldn't it retrigger the latch and give more than
1 count per pulse?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m231030
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\15@125230 by Sparks-R-Funn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote:

Since I do not see JonnyMac online at the moment, I will attempt to answer this.  I hope no one minds. :blush:

[QUOTE="verobel"] ps. Jon, If the pulse stayed high long enough wouldn't it retrigger the latch and give more than 1 count per pulse? [/QUOTE]
Actually, the Port B pins conditionally trigger and latch on pulse EDGES where the signal RISES or FALLS.  Once the signal is high, resetting the latch will not cause it to trigger again until the signal falls and then begins to rise again.

- Sparks
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m231035
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\15@125334 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

John,
You won't get more than one count per pulse with the code I gave you.  Note that there is a bit variable called "lastScan" that is updated each time through.  The only time the counter gets incremented is when the last scan was zero and the new scan is one; the code is looking for a low-to-high change on the sensor input line.  And they can't come at the "wrong" time if you use a polled interrupt versus using edge triggered.  The only thing you need to do is make sure your periodic interrupt is running fast enough to catch the pulses.

How fast does your bike go?
What is the distance from the axle to the magnet placement?
What is the diameter of the magnets?

With these numbers and a calculator you should be able to estimate -- pretty reasonably -- your pulse rate and pulse width.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m231038
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\15@125853 by Sparks-R-Funn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote:

Hey, JonnyMac.

  Somehow I did not see you there.  I was anxious to post!  Sorry about that.  :blush:

- Sparks
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m231041
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\11\15@130205 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

No worries! We're all here to help each other.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m231042
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)


'[SX] I2C counter OR counter + parallel/serial I2C'
2007\12\14@092539 by verobeln/a
flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

Fellow Sxers;
I have added some code to the timer program to count melexis pulses on RB.7 but it doesn't seem to work. Could anyone review the code and tell me what is wrong?

Thanks, John
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m236347
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\12\14@103226 by beann/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote:

Try changing this code at the start of your interrupt routine from this:



 ' chk if RB.7 is latched, if so increment mCount and reset it for next pulse
 ' ** interupt routine must be running more frequently than fastest pulse **
WKPND_B = latchB  
 latchA = latchB AND %10000000                            
IF latchA = %10000000 THEN
  ' WKPND_B.7 = 1 THEN
  sensorCount = sensorCount + 1
  WKEN_B = %11111111                            ' reset latch
ENDIF

To This:



 ' chk if RB.7 is latched, if so increment mCount and reset it for next pulse
 ' ** interupt routine must be running more frequently than fastest pulse **
latchB = 0
WKPND_B = latchB  
sensorCount = sensorCount + latchB.7


Bean
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m236356
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\12\14@201737 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

Hi Bean... I tried your code. Not working properly yet but closer. I was wondering about the reset WKEN_B=%11111111 ... I still seem to need that.. or does latchB = 0 reset the latches?

I was seeing numbers flying by... or constant... but not 1 digit increment with each pass of magnet... so I hooked same signal to external counter circuit with its own display (74LS90) and then both the external counter circuit and the sx seemed to respond to the inputs better.
The external count increment exactly by one count for each magnet pass.

However, the SX rb.7  tends to give multiple counts for each magnet 'pass'. I figure sx interupt is so fast that during the time that  I pass the magnet it must be resetting and setting several times till the magnet is out of the sphere of influence. Any ideas on how to fix that?

Thanks, John
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m236433
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\12\14@202129 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

.. also the SX rb.7 doesn't work properly unless signal also goes to external counter ciruit... it is like it is conditioning it somehow.. might I need a pullup resistor?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m236435
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\12\14@205107 by verobeln/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote:

I put the pull up resistor from Vdd to output... it seems to help.. but The SX rb.7 will not detected unless the external ciruit is attached. Why is that?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m236439
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

2007\12\15@141202 by Sparks-R-Funn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote:

It sounds like you may have a signal detection problem in hardware and/or a software operation problem.  I recommend connecting a simple switch in place of the sensor to see if that triggers your software in the expected way.  (NOTE: You will probably need a pull up resistor on the switch.  Enabling the internal pull-up for that pin on the SX should suffice.  Since mechanical switches can generate a lot of "noise" when they open or close you will probably also need to debounce the input.  I do not want to make this sound complicated.  You can find many debounce circuits online.  For the sake of experimenting, though, a simple PAUSE command to wait half a second or so once a switch event has been processed should suffice for this purpose.)  Then press and release the button to see if you get one and only one count for every button press.

Basically, I think it would help to first establish that your software code works as it should.  Then tackle the possibility that the hardware is not detecting the signal accurately.

- Sparks
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m236530
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...