Quite some time ago on this forum I started a thread about using small and cheap micros in place of more expensive and limited peripheral chips such as MCP3208s etc. For around one or two dollars or so you can have a better 12-bit ADC chip with lots of features and even program in your own acquisition code to filter and average etc if you like. Normally I interface via the I2C lines and there is no reason why the PPC can't also drive some LEDs and monitor your serial receive line for special control sequences etc. Most of these chips have ADC, DAC, PWM, UART, SPI, I2C plus they are fast and have a very good precision oscillator.
At that time I also released some Spin code that could program the PPC with an embedded binary file compiled from whatever 8051 software tools you so desired. C8051s are very fast at 25 or 50 MIPS yet are simple to write code for even in assembler. Now I have released working Flash programming code in Tachyon Forth which takes up less than 900 bytes of code including the Intel Hex loader utility. So you can design boards with these chips instead of the limited and "why are they so much more expensive" dumb peripheral chips. The con with this chip is that except for a couple of DIP packs most of the series are only available in SMD (mostly QFN but not all).
The reason I wrote this code in Tachyon Forth is because I designed my new QVGA TFT driver using a $1.60 chip that enables me to talk to the display via a hybrid I2C that can shift into high speed 2-wire SPI mode. The chip also takes care of power-up reset as well as block operations such as clearing the screen and fills etc. Well, it can even do everything anyway if it has to but there are some things I like to leave for the Propeller to handle. This is the block diagram for this particular one that is in an easy to solder by hand 24 pin QSOP pack. BTW, it may even handle the touch screen too.
I also had to get this display working because it's one of the prizes in the Forth of the Forth competition for which I will announce the winners this weekend.
I fixed the bug with DEBUG, funny that. The problem lay in a simple word which is used to point to the stacks in the cog and it had been moved to interpreted bytecode to free up a couple of longs. In fact there were two bugs with it, one in the definition and the other in the vector table entry. All fixed.
Where are the corrections ??? I did not see any new kernel so I used 11/14 and I grabbed EXTEND 12/14. IN that configuration ^D is still broken!
Where are the corrections ??? I did not see any new kernel so I used 11/14 and I grabbed EXTEND 12/14. IN that configuration ^D is still broken!
Maybe you need to refresh the page or directory, it certainly is there. Either way here are the files and I had to change the name of EXTEND.fth to EXTEND.fth.txt just so the forum uploader would see it???
Thanks for looking into and fixing this so quickly Peter! BTW - I just looked on Dropbox and don't see the update there either.
You might be right about the dropbox thing, I've got a funny feeling that since I updated my Linux system that my Dropbox needs to be reinstalled. Sorry about that, I will fix that up right now.
Peter - I finally got a chance to try this release out, and the dropbox version looks o.k. as far as the ^D command. I did notice that the behavior of both WORDS and QWORDS changed. Here's what I see:
Propeller .:.:--TACHYON--:.:. Forth V21121214.1800
NAMES: $63E3...7464 for 4225 (22955 bytes added) with 23159 bytes free
CODE: $0000...26CF for 5710 (3791 bytes added) with 22833 bytes free
CALLS: 0668 vectors free
.
MODULES LOADED:
1800: EXTEND.fth Primary extensions to TACHYON kernel - 121214.1900
----------------------------------------------------------------
WORDS
NFA PFA EXT ATRS NAME
-----------------------
63E4 26C9 YB1 ...: COLD. ok
QWORDS
COLD
ok
I was curious what 8051 tools you use. We used Keil at work and have shipped many 100's of millions embedded 8051 cores. (I can't say a billion for certain ;-) You would be surprised where they end up. I think that those tools are a bit pricey for home use though - we chose Keil because it supported the FS2/MIPs debugger that we used. If people follow your advice it's amazing to think about how many of these 8051s could be out there.
Just had a thought looking at your last post that maybe the terminal emulator is trying to software handshake or something because the WORDS and QWORDS terminated immediately which means it has detected user (or ab'user) interruption. Make sure the terminal settings are no hardware or software handshake, no character delay, and 10ms line delay.
As for CASE it's one of those words I was playing with that are unfinished but I had an application the other day that could use a good case statement so this little word may be reactivated and revamped.
Just had a thought looking at your last post that maybe the terminal emulator is trying to software handshake or something because the WORDS and QWORDS terminated immediately which means it has detected user (or ab'user) interruption. Make sure the terminal settings are no hardware or software handshake, no character delay, and 10ms line delay.
As for CASE it's one of those words I was playing with that are unfinished but I had an application the other day that could use a good case statement so this little word may be reactivated and revamped.
Peter - I think that you're correct about some sort of corruption during the upload of EXTEND.fth. I've had problems when putting in a zero character delay too. It looks like some others have had this problem as well. Maybe I should install Linux and give minicom a try just to see how much better it works. I just tried various pacing delays and terminal emulators, and was able to get an upload where WORDS works.
In the future would it be easy to add some sort of CRC check of the EEPROM contents? And then you would publish the golden CRC? I'm not sure how well this would work if people make changes to the base build - e.g. the baud rate. Maybe it could just be done when serial uploading is occurring? Or just to a portion of EEPROM?
Peter - after playing around some more and found out what was going on most recently. My terminal program "CoolTerm" was sending CR/LF for the Enter key, and this was interrupting the operation of WORDS/QWORDS. When I turned this off it works. It explains why I got different results in different terminal programs due to the different default settings.
Peter - is this a bug or dialect issue? According to Forth Application Techniques the definition for WITHIN is:
WITHIN ( n nlow nhigh - t ) Returns true is nlow <= n < nigh
' ( n lo hi -- flg ) true if n is within range of low and high inclusive
WITHIN byte INC,OVER,MINUS,PUSHR
byte MINUS,RPOP,XCALL,xULT
WT1 byte ZEQ,ZEQ,EXIT
Win32Forth:
System Editor is: Win32Forth IDE
: ISASCII ( n - )
#32 #128 WITHIN IF ." VALID CHARACTER" THEN ; ok
#31 ISASCII ok
#32 ISASCII VALID CHARACTER ok
#127 ISASCII VALID CHARACTER ok
#128 ISASCII ok
Tachyon:
: ISASCII ( n - )
#32 #128 WITHIN IF ." VALID CHARACTER" THEN ; ok
#31 ISASCII ok
#32 ISASCII VALID CHARACTER ok
#127 ISASCII VALID CHARACTER ok
#128 ISASCII VALID CHARACTER ok
PS - I guess that I could have chosen a better name for the word, and it should probably be looking for < 127 not < 128, but the main question is about the actual implementation of WITHIN.
The ANS version of WITHIN is true if n >= low and n < high. There is a non-standard COMUS Forth word, which is BETWEEN that is true if n >= low and n <= high. It can be implemented with ": BETWEEN 1+ WITHIN ;" It appears that Tachyon's implemention is consistent with BETWEEN.
Peter - after playing around some more and found out what was going on most recently. My terminal program "CoolTerm" was sending CR/LF for the Enter key, and this was interrupting the operation of WORDS/QWORDS. When I turned this off it works. It explains why I got different results in different terminal programs due to the different default settings.
Normally the LF is discard on line inputs but still accept as a KEY character. Perhaps I could just modify QWORDS to ignore LFs.
The ANS version of WITHIN is true if n >= low and n < high. There is a non-standard COMUS Forth word, which is BETWEEN that is true if n >= low and n <= high. It can be implemented with ": BETWEEN 1+ WITHIN ;" It appears that Tachyon's implemention is consistent with BETWEEN.
The ANS version is the problem as WITHIN is either within those inclusive limits or not and BETWEEN is between the limits themselves. When Forth was not tied to the vastly unpopular ANS standard it remained popular. I don't have a big problem changing BETWEEN to suit if that really helps though. But there are plenty of other things that are never going to be ANS in Tachyon anyway.
I'm not trying to force ANS Forth onto Tachyon. I understand that Tachyon is a machine Forth and not a standard Forth. It just helps to avoid confusion to use the same definition when using an ANS Forth word. If you want the word to act differently it might be wise to use a different name to avoid confusion.
Thanks Peter. I'm just pointing out things like this since they might cause some confusion. I don't know the history well enough to make a strong recommendation.
When something is really logical but it's not done that way because of a standard or tradition then I buck the system when I am free to do so. I never intended WITHIN to be nonstandard but when you look at what the standard says, that it has an inclusive limit at one end but not at the other then it doesn't make a lot of sense, who am I to judge but maybe the ANS committee were smoking some tobacco that smelt funny.
As for renaming it well that's the annoying part because it's the right name for that function if you want it to flow in a statement like this:
"0" "9" WITHIN IF
Otherwise I could use less readable but logically correct symbols like this:
"0" "9" =><= IF
But if I make it ANS then it doesn't look right either as you lose the sense of it:
"0" ":" WITHIN IF
When something is really logical but it's not done that way because of a standard or tradition then I buck the system when I am free to do so. I never intended WITHIN to be nonstandard but when you look at what the standard says, that it has an inclusive limit at one end but not at the other then it doesn't make a lot of sense, who am I to judge but maybe the ANS committee were smoking some tobacco that smelt funny.
As for renaming it well that's the annoying part because it's the right name for that function if you want it to flow in a statement like this:
"0" "9" WITHIN IF
Otherwise I could use less readable but logically correct symbols like this:
"0" "9" =><= IF
But if I make it ANS then it doesn't look right either as you lose the sense of it:
"0" ":" WITHIN IF
So, do you see my dilemma?
Yes I see, and please keep bucking so us mere mortals can work on our problems and not work on the tools i.e. accidental complexity.
I'm not trying to force ANS Forth onto Tachyon. I understand that Tachyon is a machine Forth and not a standard Forth. It just helps to avoid confusion to use the same definition when using an ANS Forth word. If you want the word to act differently it might be wise to use a different name to avoid confusion.
A machine forth is correct and for myself a solution to physical engineering problems require software and hardware, not some generic portable ANS software tool but targeted to actual hardware. C, C++ users forget about libc and all the rest of the library systems that must be physically tied to the hardware in order to make them appear "portable". Tachyon is not about Alt-Lang it's Alt-Project in my world.
Since you mention machineforth I was curious if any of you have tried programming something like the Greenarrays (or predecessors), b16 (influenced by Chuck) or other similar processors. I wonder how the size of these cores compares to a COG? Maybe something to do with your DE0/DE2 boards once the Prop2 silicon arrives. I tried b16 a while back, but it was too much of a jump for me and I found it very frustrating.
I asked about this earlier, so thought it only fair to post some results. You can use a Galaxy Nexus 7 as a serial terminal for communicating with Tachyon Forth. I tried Slick USB 2 Serial Terminal and that didn't work, but USB Serial Monitor Lite works o.k. It's not a sophisticated program, so I'll search for some alternatives. All I used was a USB OTG cable with the micro connector which plugs into the Nexus, and then the USB cable with the mini connector to plug into the Parallax Prop Plug. The Nexus doesn't appear to supply power, so you can't just plug into a QuickStart board without a separate power source.
Anyways this is a very portable solution, and I think that it beats looking at composite video and having to plug in a keyboard. Sorry for the shakey photo.
I asked about this earlier, so thought it only fair to post some results. You can use a Galaxy Nexus 7 as a serial terminal for communicating with Tachyon Forth. I tried Slick USB 2 Serial Terminal and that didn't work, but USB Serial Monitor Lite works o.k. It's not a sophisticated program, so I'll search for some alternatives. All I used was a USB OTG cable with the micro connector which plugs into the Nexus, and then the USB cable with the mini connector to plug into the Parallax Prop Plug. The Nexus doesn't appear to supply power, so you can't just plug into a QuickStart board without a separate power source.
Anyways this is a very portable solution, and I think that it beats looking at composite video and having to plug in a keyboard. Sorry for the shakey photo.
Yes, I use the Nexus 7 as well as other devices but over Bluetooth to talk to my Forth systems. I even have text editors etc so I edit, copy, and paste into Blueterm and I am able to load in new firmware easily. I even have clients using this method as I have my running systems constantly send out operating and diagnostic information over the serial port, all they have to do is connect somewhere within range and all the information just appears automatically. In these cases I normally have a simple single character command they can use to effect changes or even escape back to the Forth console for more advanced stuff. Surprisingly Bluetooth works very effectively in an open area so that I have no problems at all communicating to many units scattered over the factory floor while I find a nice comfortable place to sit. If there appears to be a problem somewhere I normally just type in a little one-liner that captures that problem and reports back to me. One more of many reasons to use Forth in embedded control systems.
Yes, I use the Nexus 7 as well as other devices but over Bluetooth to talk to my Forth systems. I even have text editors etc so I edit, copy, and paste into Blueterm and I am able to load in new firmware easily. I even have clients using this method as I have my running systems constantly send out operating and diagnostic information over the serial port, all they have to do is connect somewhere within range and all the information just appears automatically. In these cases I normally have a simple single character command they can use to effect changes or even escape back to the Forth console for more advanced stuff. Surprisingly Bluetooth works very effectively in an open area so that I have no problems at all communicating to many units scattered over the factory floor while I find a nice comfortable place to sit. If there appears to be a problem somewhere I normally just type in a little one-liner that captures that problem and reports back to me. One more of many reasons to use Forth in embedded control systems.
Bluetooth would be even nicer I agree, but this was free ;-) Is there any particular Bluetooth adaptor that you recommend based on your experience?
Would the Seeed Bluetooth Shield be worth buying? It's at Radio Shack and I have a long holiday coming up.
Bluetooth would be even nicer I agree, but this was free ;-) Is there any particular Bluetooth adaptor that you recommend based on your experience?
Would the Seeed Bluetooth Shield be worth buying? It's at Radio Shack and I have a long holiday coming up.
I posted some info back in in this thread where I have used those serial Bluetooth modules from ebay except I made my own backplane to suit the enhanced Prop plug compatible connection that I use.
I posted some info back in in this thread where I have used those serial Bluetooth modules from ebay except I made my own backplane to suit the enhanced Prop plug compatible connection that I use.
Thanks for the pointer Peter. That looks interesting. I'll be keeping my eyes open for any availability announcements. I saw those on Ebay too, so it's nice to know that they actually work.
I posted some info back in in this thread where I have used those serial Bluetooth modules from ebay except I made my own backplane to suit the enhanced Prop plug compatible connection that I use.
Yes those modules you have are tempting but elusive until your store is online which brings up my favorite Content Management System (CMS) with integrated, seemless ecommerce package: contao/isotope all php based and open source, really nice once setup. Much different that Jumla et al with magento.
Yes those modules you have are tempting but elusive until your store is online which brings up my favorite Content Management System (CMS) with integrated, seemless ecommerce package: contao/isotope all php based and open source, really nice once setup. Much different that Jumla et al with magento.
Yes, I want to do it right which is why I might even just do some simple web pages in the meantime with the aim of adding shopping carts and all that that entails.
Yes, I want to do it right which is why I might even just do some simple web pages in the meantime with the aim of adding shopping carts and all that that entails.
Let me know if you want to see contao / isotope sometime, I can give you a quick tour (front end / backend ) when your ready to do it right. In the meantime I think there are a few on this forum looking for puppys with blueteeth!
I have preliminary completion of a set of words comprising a Toolkit for the DalSemi/Maxim DS1307 Real Time Clock. Although it is a 5V chip it has been running fine for several days on 5V with a pair of 1K resistors in the lines to SDA and SCL.
You may notice that even though I wrote BCD>INT and INT>BCD I for t he most part leave the RTC data in BCD and simply use .BYTE to do display data. The two instances in the enclosed code that I do BCD conversions are to get accurate values to index into a string array for labels for month and day of week.
I also included the DS1307 Data Sheet it can also be found in my shared DropBox
Comments
Where are the corrections ??? I did not see any new kernel so I used 11/14 and I grabbed EXTEND 12/14. IN that configuration ^D is still broken!
I was curious what 8051 tools you use. We used Keil at work and have shipped many 100's of millions embedded 8051 cores. (I can't say a billion for certain ;-) You would be surprised where they end up. I think that those tools are a bit pricey for home use though - we chose Keil because it supported the FS2/MIPs debugger that we used. If people follow your advice it's amazing to think about how many of these 8051s could be out there.
As for CASE it's one of those words I was playing with that are unfinished but I had an application the other day that could use a good case statement so this little word may be reactivated and revamped.
Peter - I think that you're correct about some sort of corruption during the upload of EXTEND.fth. I've had problems when putting in a zero character delay too. It looks like some others have had this problem as well. Maybe I should install Linux and give minicom a try just to see how much better it works. I just tried various pacing delays and terminal emulators, and was able to get an upload where WORDS works.
In the future would it be easy to add some sort of CRC check of the EEPROM contents? And then you would publish the golden CRC? I'm not sure how well this would work if people make changes to the base build - e.g. the baud rate. Maybe it could just be done when serial uploading is occurring? Or just to a portion of EEPROM?
WITHIN ( n nlow nhigh - t ) Returns true is nlow <= n < nigh
Win32Forth:
Tachyon:
PS - I guess that I could have chosen a better name for the word, and it should probably be looking for < 127 not < 128, but the main question is about the actual implementation of WITHIN.
As for renaming it well that's the annoying part because it's the right name for that function if you want it to flow in a statement like this:
"0" "9" WITHIN IF
Otherwise I could use less readable but logically correct symbols like this:
"0" "9" =><= IF
But if I make it ANS then it doesn't look right either as you lose the sense of it:
"0" ":" WITHIN IF
So, do you see my dilemma?
Yes I see, and please keep bucking so us mere mortals can work on our problems and not work on the tools i.e. accidental complexity.
A machine forth is correct and for myself a solution to physical engineering problems require software and hardware, not some generic portable ANS software tool but targeted to actual hardware. C, C++ users forget about libc and all the rest of the library systems that must be physically tied to the hardware in order to make them appear "portable". Tachyon is not about Alt-Lang it's Alt-Project in my world.
Since you mention machineforth I was curious if any of you have tried programming something like the Greenarrays (or predecessors), b16 (influenced by Chuck) or other similar processors. I wonder how the size of these cores compares to a COG? Maybe something to do with your DE0/DE2 boards once the Prop2 silicon arrives. I tried b16 a while back, but it was too much of a jump for me and I found it very frustrating.
-Keith
Anyways this is a very portable solution, and I think that it beats looking at composite video and having to plug in a keyboard. Sorry for the shakey photo.
Yes, I use the Nexus 7 as well as other devices but over Bluetooth to talk to my Forth systems. I even have text editors etc so I edit, copy, and paste into Blueterm and I am able to load in new firmware easily. I even have clients using this method as I have my running systems constantly send out operating and diagnostic information over the serial port, all they have to do is connect somewhere within range and all the information just appears automatically. In these cases I normally have a simple single character command they can use to effect changes or even escape back to the Forth console for more advanced stuff. Surprisingly Bluetooth works very effectively in an open area so that I have no problems at all communicating to many units scattered over the factory floor while I find a nice comfortable place to sit. If there appears to be a problem somewhere I normally just type in a little one-liner that captures that problem and reports back to me. One more of many reasons to use Forth in embedded control systems.
Bluetooth would be even nicer I agree, but this was free ;-) Is there any particular Bluetooth adaptor that you recommend based on your experience?
Would the Seeed Bluetooth Shield be worth buying? It's at Radio Shack and I have a long holiday coming up.
Thanks for the pointer Peter. That looks interesting. I'll be keeping my eyes open for any availability announcements. I saw those on Ebay too, so it's nice to know that they actually work.
Yes those modules you have are tempting but elusive until your store is online which brings up my favorite Content Management System (CMS) with integrated, seemless ecommerce package: contao/isotope all php based and open source, really nice once setup. Much different that Jumla et al with magento.
Yes, I want to do it right which is why I might even just do some simple web pages in the meantime with the aim of adding shopping carts and all that that entails.
Let me know if you want to see contao / isotope sometime, I can give you a quick tour (front end / backend ) when your ready to do it right. In the meantime I think there are a few on this forum looking for puppys with blueteeth!
You may notice that even though I wrote BCD>INT and INT>BCD I for t he most part leave the RTC data in BCD and simply use .BYTE to do display data. The two instances in the enclosed code that I do BCD conversions are to get accurate values to index into a string array for labels for month and day of week.
I also included the DS1307 Data Sheet it can also be found in my shared DropBox