View Full Version : BS2e with 96 I/O pins?

Jack Jordan
09-05-2008, 10:17 PM
I am trying to use a BS2e Rev E in an 8 bit data bus configuration through an 82C55A programmable peripheral controller. I am able to read·selected ports through the 82C55 in an 8 bit binary format to check home position and status switch closure and branch to "some_method".

The BS2e seems to be a logical choice for my 3+ axis project. 8 pins data, 4 pins address, and 4 free pins which will be used later for chip select on·4 seperate·82C55As giving a possible 96 pin bi-directional control system.

The problem I get is logic contentions when the circuit boots. It seems the closed status switch feeds 5v back to the stamp which also boots with all pins high. Is there a way to boot the stamp with all pins low, or am just missing something else?


Mike Green
09-05-2008, 10:22 PM
The Stamp initializes with all I/O pins in input mode. The voltage on them "floats" until they're set to output mode. To provide a known default state, you would need a "pull down" (to ground) or "pull up" (to Vdd) resistor of 4.7K or 10K on the I/O pin(s).

Jack Jordan
09-05-2008, 10:48 PM
Thanks Mike. The known state is a must.

However I'm still missing something in my circuit. I still get logic contentions with pull up or pull down resistors.

I found that moving chip select out of the Set_Up: method to the Main: method fixed the problem.


T&E Engineer
09-06-2008, 05:16 AM
Take a look at this BS2 - 8255 output project I did some time back:


And then for the SX28:

(Code is 3/4 down)

Jack Jordan
09-06-2008, 06:08 AM
Thanks Tim. The old thread has usful info.

I didn't stop to think about how old this stuff is. Guess I need to update my junk box.

My current project (When compeleted) will allow control of 4 stepper motors (position accuracy) per 8255. Using the 4 free pins for CS gives a total of 16 motors.

I am interested to know why you set CS low then back high in each method.


T&E Engineer
09-06-2008, 07:22 AM
I'm not sure I remember completely but I believe it was something I read in the data sheet that CS had to transition from a low to a high after a write cycle. It works well like it is. Trust me, if it was not needed it would not be like that. I tried many combinations to get the right setup based on the datasheet.

Do you have any working code yet?

Keep in mind that the 8255 is quite slow when·switching from output to output as compared to using (3) 74HC595 ICs. So don't use·the 8255·for any larger LED matrix scanning.


Post Edited (T&E Engineer) : 9/6/2008 12:31:16 AM GMT

Jack Jordan
09-06-2008, 08:27 AM
Test show that the 8255 (82C55A-5) boots in mode 0, $9B, all ports set to input, based on data sheet info. This reduces the need for code to set up the chip. I have also found that input can be accuried by pulsing the RD pin, output sent by "READ addressData, addressBus" with a pulse to the WR pin.

I have working code that moniters real world input connected to port A (8 bits) and directs response to port B low, port B high, port C low, port C high.

I read the input pins "INL" as a binary number and direct output based on the decimal eqivlent. One of 255 possible.

As for responce time, the BS2e only runs 4k instructions/sec. What i'm doing is reading input and directing output based on predefined data accordingy. The DO - LOOP at this low MHz provides real time data access without timing PAUSE. "PULSOUT RD, 1" , "PULSOUT WR, 1" works great.

If you see a bug in my logic, PLEASE let me know.

Jack Jordan
09-08-2008, 08:18 AM
I now have clearance to post basic core code snipit and screen shot.

Hope this helps.