Making a BS2 from scratch
AwesomeCronk
Posts: 1,055
in BASIC Stamp
Hello, I have heard that the BS2 Interpreter is a PIC module, and that is is not in itself programmed, that it simply reads the PBASIC tokens and executes them. Is it possible to get that PIC module and find the PBASIC "tokenizer" program, load it, then us it as a replacement interpreter on a BS2?
Comments
You have it wrong!
The PIC is programmed with the PBASIC interpreter.
The PBASIC program is stored in an external EEPROM as tokens.
I see what You mean. I think I would just have to get the SSOP version of the interpreter that Parallax has.
Genetix
I thought that the PIC was the large "Interpreter" on the bottom half of the module. If not, then where is it?
Thanks guys.
Parallax used to sell a programmed PIC, to allow you to build a Stamp in any form factor.
Does not seem to be on the website anymore ?
Edit : since found one here
' Is it possible to get that PIC module and find the PBASIC "tokenizer" program, load it,'
No.
They are only sold pre programmed with bootloader to work with PBasic Editor and firmware on there
to run programs.
You are thinking of Micromite.
They tell you what 32MX PIC to get and you can program it one time with a PICKit 3 and then it is a Micromite.
'So PICs are a one shot deal as far as programming? '
PIC's can be reprogrammed virtually forever like a Stamp.
Okay. You have to get off on the right foot here and avoid any misconceptions at
the beginning that are hard to shake off.
Stamp are like PIC's with training wheels.
They protect you from some of the things that take a while to learn.
Bottom line get a Stamp 2 Board of Education or Homework board and start doing experiments in Basic.
Keep that in mind.It's Basic language. Easy to learn.
Later if you like this kind of thing it will be PIC's with C language.
Or Propeller with C if you really find a home here.
The Stamp does not have a bootloader, it's an interpreter.
You are thinking of a Picaxe which uses a bootloader.
Stamp programs are stored in the EXTERNAL EEPROM, not the PIC itself.
The PIC is programmed with Parallax's Stamp PBASIC interpreter.
When the Stamp is reset, the interpreter grabs the PBASIC tokens (program) from the external EEPROM and starts executing them.
Genetix
Can that scheme be adapted to PIC and it's .hex files ?
Genetix
I have a glimmer of how it works.
The IDE sends bits to the interpreter.
Now the interpreter I may have miscalled it a bootloader.But there is some firmware in there.
Which I believe is using up the program and data memory on the underlying PIC.
Hence no room for instructions anyhow.
Then the bits are converted to assembler instructions for the PIC by this 'interpreter'.
That about how it works?
Not quite. Typically the IDE translates the Basic instructions into a number of "bytecodes", and the "interpreter" jumps to a PIC assembler subroutine based on that bytecode. A Basic instruction will produce one or more Bytecodes, and each Bytecode subroutine will be two or more PIC assembler instructions.
Can that be done for PIC's and it's .hex files?
Or has it already been done with the bootloader's?
Are you sure about the subroutine part?
How about assembler macros?
Awsome Cronk
Do you have any more questions about what Basic Stamp to use?
The PBasic interpreter does not translate these bytecodes into PIC instructions. The interpreter is a PIC program that reads bytecodes from the attached EEPROM and performs the operations encoded in the bytecodes.
The BASIC Stamp Editor does not compile programs.
A compiler converts a program to Machine Language or the Operation Codes for each instruction.
The BASIC Stamp Editor tokenizes the program or it encodes it a special format that tells the Interpreter what the command is what data it needs for that command.
A tokenized program is not Machine Language so a PIC can not use it, only the PBASIC interpreter burned into the PIC of a Stamp module.
Also, the BASIC Stamp Editor downloads the program onto the external EEPROM of the Stamp Module.
IT DOES NOT DOWNLOAD THE PROGRAM INTO THE PIC CHIP OF THE STAMP MODULE!
The PIC was programmed by Parallax with their PBASIC interpreter which has never been released to the public.
Okay.Looks like tokenizing and interpreting is only useful if you intend on packaging a language with it.
Which brings up a question.
Why in all this time has Parallax not added a PIC with more memory and brought out a C language?
Okay.As far as 'Does a bootloader help with PIC's?'.Yes it does.
It gets you part of the usefulness of a Stamp but you can still use assembler and C.
Awesome Cronk
I have not forgotten about you.
Take a look at the 'bettter' stamps.The Stamp 2 SX through the Stamp P40.
They add a lot of features to the Basic Stamp.
If you can solder surface mount they have processors only for $12.99 each.
https://www.parallax.com/catalog/microcontrollers/basic-stamp/oem
THAT is a good deal!
Best deal in a DIP is the Stamp 2 SX.
A rule of thumb is you always get the most chip you can for the money.
Highest pin count, most memory and most peripherals.
One thing at a time.
What about the BS2 repair?
Yes.If you use Basic Stamp 2 DIP version then the Stamp WITH the interpreter progammed on to it and the
EEPROM would be separate.
Then if the DIP or the EEPROM fail you just have to replace one.
Like the old rule.Don't buy a TV with a built in DVD player.If one goes out then you have to replace the whole thing.
Hope that helps.
Contact Parallax Technical Support.
EEPROM memory cells are good for over a million writes so unless you constantly write to them they shouldn't wear out.
Been there, done that, but interest just wasn't there....
https://forums.parallax.com/discussion/143318/35-mini-propeller-module-propbsc-cancelled/p1
On another thread, I posted something more related to this thread about building your own BS2PX equivalent stamp: