BASIC Stamp 2P40 Interpreter Chip (TQFP)
hmlittle59
Posts: 404
Hello All,
I've designed/changed a current PCB design from the OEM BS2e Interpreter to this 40 pin chip. Is there any thing special that yall can tell me about on how to access the I/O pins? I've used Shift Registers before to increase my pin count, but this new chip will be cleaner (less chip count). Some sample code on the pin commands would be nice. I noticed that some pins start with (P) and (X), how are they accessed and is there any thing tricky that I have to look out for.
I just need a good starting point and any (OOOPs) don't do this information. My current program is for the BS2 and BS2e (5 ram slots), so the BS2e code is the one that will be modified to access the extra pins.
Thanks for any HEADS UP info.
Howard
www.GarageDoorValet.com
I've designed/changed a current PCB design from the OEM BS2e Interpreter to this 40 pin chip. Is there any thing special that yall can tell me about on how to access the I/O pins? I've used Shift Registers before to increase my pin count, but this new chip will be cleaner (less chip count). Some sample code on the pin commands would be nice. I noticed that some pins start with (P) and (X), how are they accessed and is there any thing tricky that I have to look out for.
I just need a good starting point and any (OOOPs) don't do this information. My current program is for the BS2 and BS2e (5 ram slots), so the BS2e code is the one that will be modified to access the extra pins.
Thanks for any HEADS UP info.
Howard
www.GarageDoorValet.com
Comments
This does introduce a new class of bugs, where a program expects to be addressing one bank, but some other program code has left it in the opposite bank. You have to start thinking about that systematically. It is generally a good idea to group the external interfaces so that the pins for each external device are concentrated on either the p bank or the x bank.
One hurdle in moving to the BS2p is that many of the timing parameters are different than the BS2 and BS2e. A PAUSE is in units of milliseconds in either case, but other things such as baud rate parameters for SEROUT and SERIN are different, and also timing for things such as the PULSIN PULSOUT etc. etc. It is all laid out in the Stamp manual, command by command. Of course the program code itself also runs faster, so you may have to account for that if you have program loop delays.
The BS2p offers commands that are not found in the BS2 and BS2e. For example, there is I2CIN I2COUT to ease interface to I2C peripherals. The I2C commands can reference only p0, p8, x0 or x8, so that is unusual in that most commands can reference any pin. There are POLLing commands on the BS2p that do certain pin actions automatically apart from running program code, and they can be great in certain very specific situations, . The BS2p also has more flexible cross-slot access to the 8 eeprom memory banks, and also 127 bytes of scratchpad RAM.
Thanks for your replies. I read through some of the Commands in the help files and it does not look user friendly. I don't know whats going to cost more, leaving the extra parts on the board or changing the code. I will be needing 24 I/O pins so I hope to keep the bouncing back and forth to a minimum. Some pins have to constantly be monitored and others just turn on/off LED's. My initial thinking now with your info is that this will be a problem. I may have to move certain parts to "AUXIO" and bounce back to "MAINIO" for my pseudo real time monitoring. This may get real tricky. I monitor what ever pin(s) that I need to in any slot now, but that may not work with this chip.
The PCB layout is done but I have not ordered any new ones yet. I may have to buy a BS2p40 module and see if I can get the code to work like I want.
Thanks again for the info, any more thoughts please let me hear about them.
Howard
www.GarageDoorValet.com
It would indeed be a good idea to try it out with a BS2p module before you commit to a PC board. I gather from your topic that you're planning to build this up on your own board using the TQFP chip.
Thanks for the reply. Yes I'm want to do my own PCB for this project. After spending some quite time thinking this over I think that I have a plan of attack. Currently things are a bit mixed up and in the wrong place, but I did group a lot of the same parts on one side of the PCB to keep it in some kind of order, but now they are on the bank. I will lay out the PCB in the next 2 days and study some more of the commands. I'll be getting back with you when that's done. Again, some parts are LED's or SSR's so it may very well work.
Thanks again
Howard
www.GarageDoorValet.com
Are you going to use the BS2p40 module or the OEM chip? If you are just starting with the BS2p40 OEM chip I have a board that you can use to mount that chip to help get familiar with the OEM version of the chip. You can see the docs for the board here:
http://www.robotworkshop.com/robotworkshop/projects/parallax/BS2p40oem.pdf
http://www.robotworkshop.com/robotworkshop/projects/parallax/BS2p40OEMschematic.pdf
Boards are $2.95 each plus shipping....
Robert
Sorry I didn't reply back right away. I did look at your links but I think that I would rather build my own OEM PCB's and get it to work. I'm burning through lots of cash any way, whats a couple of hundred bucks more. WOW...Some day I may see a return on my investment. The PCB is done and now I will go over it for the next week or 2 before I think about placing an order from some place in the USA or Overseas.
Thanks.
Howard
www.GarageDoorValet.com
When the boards come back a week or two later, then stuff them, test them and see if your design is already perfect (!) or if it needs further minor or major adjustments. A stencil helps make it come out really nice, and a good economical source for the stencil is oharap.
1) CLK PIN 00.....Mainio
16) PIEZO PIN 00...Auxio
Will the second assignment over write the first assignment and in BANK1 change the assignment? Hope this is clear. I can't find a clear explanation with the on line help. The Syntax checker in the EDITOR says it's OK. I can't test it yet without my boards.
Thanks again
Howard
Howard,
In the online help under AUXIO (under Quick Facts at the top), the manual says:
I/O Pin IDs...0 - 15 (just like main I/O, but after the AUXIO command, all references affect physical pins 21 - 36).
So it looks like you'd have two pin definitions referencing the same pin number in the header section of the code. Then you'd use the second pin name after issuing the AUXIO command.
Hope that made sense...
Thanks for the reply. I did read that and was hoping that's what it meant but I was not sure. In my thinking it just don't seem right. Good , I'm going to keep coding that way until I get my boards in for testing.
Thanks again
Howard
www.GarageDoorValet.com
They're just names and are closely related to CONstant declarations. Just as one pin in Mainio can have multiple names, you can use the same names or different ones for the pins in Auxio. You just have to keep them straight in your own mind as you write the programs. Sometimes people use a prefix like "p" or "m" for mainio, or "x" or "a" for auxio, but that is just a mnemonic. For example, you might have
pLEDred PIN 7
xLEDred PIN 7
or you might just have
LEDred PIN 7
and the first form might help you remember which LED is which, but correct operation would depend on doing the MAINIO or AUXIO instruction in either case.
Thanks for the different example's to help make it clear. I put 3 of the same kind of parts + 1 other type on the second BANK and they only work from one ram slot so I should be OK. Like I said before this is from a larger program thats being modified and they were already coming off the Shift Register. I was also able to keep the LED's on BANK 1 which really helped because that code is in every slot. So now only one (1) slot has any code that will need to do any switching.
Will look over the PCB(Diptrace) again tomorrow for a final ck before ordering from the site you gave me. May order the stencil also. Not sure yet.
Thanks again
Howard
www.GarageDoorValet.com