Searching \ for 'An old question revisited.' 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/index.htm?key=old+question+revisited
Search entire site for: 'An old question revisited.'.

Truncated match.
PICList Thread
'An old question revisited.'
1999\11\11@205636 by Mathew Cohen

flavicon
face
I am constructing a device that sits on a rs485 network. The device
constantly listens to the network for information that may relate to its
device number. The device also has 16 push buttons that need to be monitored
at the same time. I am currently using a shift register to clock the push
buttons in.
The concern is I am using PicBasic Pro and it's serial routine either waits
for a character berfore continuing on with the rest of the program,which
does not help tracking the button status.  Or has a time out which the
lowest timeout  is 1ms. This leaves a lot of time for other thing to be
missed.

Can someone suggest how this could be done effectively.


Mathew Cohen.

1999\11\11@210509 by McMeikan, Andrew

flavicon
face
do your own bit banging routines and clock (several) buttons in during the
interbit delays
when you are not actually sending or receiving you can still be idling
through the delays to monitor buttons.

some creative coding may be needed but do-able.

       cya,    Andrew...

> {Original Message removed}

1999\11\11@210920 by Mark Willis

flavicon
face
Mathew Cohen wrote:
>
> I am constructing a device that sits on a rs485 network. The device
> constantly listens to the network for information that may relate to its
> device number. The device also has 16 push buttons that need to be monitored
> at the same time. I am currently using a shift register to clock the push
> buttons in.
> The concern is I am using PicBasic Pro and it's serial routine either waits
> for a character berfore continuing on with the rest of the program,which
> does not help tracking the button status.  Or has a time out which the
> lowest timeout  is 1ms. This leaves a lot of time for other thing to be
> missed.
>
> Can someone suggest how this could be done effectively.
>
> Mathew Cohen.

Yes.

<G>

(No, I'll be nice here <G>)  Put a  cap across each switch, obviously
closing the switch will discharge the cap.

Now, so long as your pull-up resistor is large enough that you have a
Tau of >> 1mS, you're covered.  Say 1uF and 10k; yeah, I know, that's a
lot of real estate for caps!  The caps can be ON the keyswitches,
though...  (Assuming that the switches are from ground to a Stamp/PIC
pin, pin pulled up by the resistor, something like that.)  Weak pullups
might be a good option here, to look at, if you move this to a PIC pin.
Hard if you use a matrix to do this, I'll have to look at that.

Other, easier/better alternatives: use a PIC chip to monitor the
keyboard & report to the Stamp serially on demand;  Use some 74HC logic
chip that latches when the switch closes, and is reset by the PIC chip
right after it's read all switches (shift register - Switches to latch,
with pullup or pulldown, you need Clock, Data, and a reset line that can
reset the logic chips && the shift registers);  Move the whole project
to a 16F84;  Those are just for starters <G>

 Mark

--
I do small package shipping for small businesses, world-wide.

1999\11\12@010919 by Stuart O'Reilly

flavicon
face
Use a pic with a hardware uart, write the program to monitor the push
buttons and write an ISR to monitor the RS485 network.
Regards
Stuart

Mathew Cohen wrote:
{Quote hidden}

1999\11\12@045956 by Joe McCauley

picon face
I always thought that this was a good way to (eventually) ruin your switch.
The energy stored in the cap is discharged directly through the switch
contacts . It may take a little time, but with small pushbuttons, or worse
membrane type keypads you could have problems. If you must do it this way
put a small limiting resistor in series with the switch. Feel free to
correct me if I'm wrong here.

The second idea seems OK. Alternativly you might be able to connect the
cathode of 8 diodes to your switches. Connect all the anodes together via a
pullup to Vdd. Connect the junction of the diodes and pullup to your INT
input.
Now when you get a key press, the INT line goes low and if you have
interrupts enabled you can read the switches. Stuck switches might be a
problem here, you might have to capacitor couple each switch to its
corrosponding diode.

Joe
{Original Message removed}

1999\11\12@063040 by Dr. Imre Bartfai

flavicon
face
Hi,

there are more possibilities.

1. You should monitor the pin receiving the serial data and branch on it
to receive only if start bit is to be seen. However, this case the other
things (monitoring buttons) should be fast enough.

2. PicBasic Pro supports IT also. Unfortunately, there is no true ISR.
However, you can attach routines to one of IT events.

3. Write an ISR in assembly (I refer here to the thread "Asm vs C").

I hope this helps.

Imre


On Fri, 12 Nov 1999, Mathew Cohen wrote:

{Quote hidden}

1999\11\12@065325 by steve

flavicon
face
> > The concern is I am using PicBasic Pro and it's serial routine either waits
> > for a character berfore continuing on with the rest of the program,which
> > does not help tracking the button status.  Or has a time out which the
> > lowest timeout  is 1ms. This leaves a lot of time for other thing to be
> > missed.

> (No, I'll be nice here <G>)  Put a  cap across each switch, obviously
> closing the switch will discharge the cap.
>
> Now, so long as your pull-up resistor is large enough that you have a
> Tau of >> 1mS, you're covered.  Say 1uF and 10k; yeah, I know, that's a
> lot of real estate for caps!  The caps can be ON the keyswitches,
> though...  (Assuming that the switches are from ground to a Stamp/PIC
> pin, pin pulled up by the resistor, something like that.)  Weak pullups
> might be a good option here, to look at, if you move this to a PIC pin.


How does this help ?
The problem is that he has two asynchronous events to monitor and can
only be looking at one at any point in time and therefore missing the
other.
There's no point in looking at switches more often than every 10ms
(50ms is good enough for most cases), which reduces the probability
of missing the address, but it is still there. It really needs the
comms to be interrupt based and if the compiler doesn't support them,
get into some ASM.

Steve

======================================================
Steve Baldwin                Electronic Product Design
TLA Microsystems Ltd         Microcontroller Specialists
PO Box 15-680, New Lynn      http://www.tla.co.nz
Auckland, New Zealand        ph  +64 9 820-2221
email: spam_OUTstevebTakeThisOuTspamtla.co.nz      fax +64 9 820-1929
======================================================

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