Shop OBEX P1 Docs P2 Docs Learn Events
Is it practical to learn propeller in 2020 ? — Parallax Forums

Is it practical to learn propeller in 2020 ?

Hello, long time since my last post here :)

I have a kind of question which I hope I can find an answer here. Before I ask, there's some intro about my level of knowledge.

1. I know BASIC programming language fairly well, started on ZX Spectrum and currently using PicBasic Pro.
2. I have no knowledge of C/C++ and so called "new" languages which use {}[];!=!X and other non logical operators, and want to avoid learning them at all costs.
3. I have some basic ASM knowledge, starting from Z80 times and some very basic PIC16 programming.
4. I tried to use Nextion displays, but their IDE is written with rear left feet, looks like bad copy of Visual Studio and works that way too. Not good.

PBP is indeed a great programming environment, but since Darrel Taylor passed away, no one bothers to develop new code to interact with "new" hardware, such as WS2812 leds, graphical displays and so on. Of course, there are some amateur(ish) code samples available, but they are far far away from perfection and usually either require very high speeds of hardware, or you can't do anything at same time, while say, driving WS2812 leds.

So I want to have a MCU, which can do the following at same time, without me using multi-level interrupts and counting clock ticks by hand, to making timings correct and ensuring everything will work fine.

Drive these color 320x240 displays, display different text, photos, shapes (I don't meant to have GUI like windows or Android, but say having 2-3 fonts at same time should not be causing any headache).
Read data from 2-3 quadrature encoders, quite high speed, up to 2khz input frequency signal.
Read data from 2-3 analog sources (8 bit precision is enough), 3-5 times per second.
Generate 3 separate PWM signals with different frequency and duty cycle (independently adjustable all)
Read time from DS3231 (once per minute)
Read temperature from DS18B20 (once per second)
According to need, drive say up to 100 WS2812 leds, TM1632 led displays, SHT11, DHT21, MAX7219, MAX6969, AD9833 and so on. I mean, the most common, hobby grade hardware which is currently supported by say Arduino libraries. When I asked back in 2017, there were no USB keyboard/mouse libraries available, so what's going on currently, any advances?

Thanks in advance!

Comments

  • Let's break down what you want.
    The Propeller 1 can do all that peripheral stuff.
    With 8 CPUs you don't need interrupts.

    Now, the 320x240 display is possible from a timing standpoint, but if you want even 8 bit color and fonts, you're going to be RAM limited. 320*240=76,800, which is more than 2 times the 32KB of the P1. You could use SPI lcd screens with built in RAM.

    As for compiler, there is the official Parallax supported propeller tool, that only does ASM and spin. And the other C stuff which you seem to be not interested in. Or the unofficial but highly functional flexgui suite that does compiled BASIC.

    Spin doesn't have { } ; statements, but uses indentation. So how far from the left side means what statements are nested. (As opposed to end if, next, etc.)

    Basic is fine, it's great, but you'll end up including spin language objects as again that's the official Parallax language.

    Questions?
  • RaymanRayman Posts: 13,861
    Personally, I'd recommend P2 over P1. But, P2 is just getting started and may take time to have as much support as P1.

    So, maybe I'd recommend getting started with P1 and then switching to P2, as soon as you can...

    There is USB KB/Mouse support with P2, BTW.
    Also, there's plenty of RAM for that 320x240 display.
  • jmgjmg Posts: 15,145
    CuriousOne wrote: »
    ...
    Drive these color 320x240 displays, display different text, photos, shapes (I don't meant to have GUI like windows or Android, but say having 2-3 fonts at same time should not be causing any headache).
    Read data from 2-3 quadrature encoders, quite high speed, up to 2khz input frequency signal.
    Read data from 2-3 analog sources (8 bit precision is enough), 3-5 times per second.
    Generate 3 separate PWM signals with different frequency and duty cycle (independently adjustable all)
    Read time from DS3231 (once per minute)
    Read temperature from DS18B20 (once per second)
    According to need, drive say up to 100 WS2812 leds, TM1632 led displays, SHT11, DHT21, MAX7219, MAX6969, AD9833 and so on. I mean, the most common, hobby grade hardware which is currently supported by say Arduino libraries. When I asked back in 2017, there were no USB keyboard/mouse libraries available, so what's going on currently, any advances?
    As above, native USB on P1 is a stretch, you would need another Host-USB MCU to manage USB keyboard/mouse on P1, but P2 has that already working.
    2-3 fonts and photos etc is also pushing P1
    2kHz Quad is not especially fast. P2 has Quad counters in HW, so you can have 20+ of those
    PWM is also native in P2 hardware, but you could maybe manage a P1 fast timing COG that did your QuadCounters and SW-PWM and nothing else.

    Take a look at what P2 can do here :
    https://forums.parallax.com/discussion/171704/propeller-2-live-forum-early-adopter-series-topics-speakers-and-registration/p1

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-07-09 00:20
    What can I say? Of course it would be that I would definitely recommend the Propeller chip. The P1 is memory constrained and so will not be able to buffer 320x240 unless you reduce the number of colors to maybe 4 (2-bits). However I have used 320x240 displays which have their own RAM and I communicate via SPI.
    However USB HID is problematic on the P1 but possible, although P2 has a lot more memory and smarts and speed etc so is able to handle this.


    You can easily use USB keyboards on the P1 if they are also PS/2 compatible, and there has been a resurgence of PS/2 for gamers. But I just use the same USB socket for USB or PS/2 and have a jumper to change the termination resistors. So you plug the keyboard directly into the USB socket but talk to it as a PS/2 keyboard without taking up a lot of resources on the P1. BTW, The USB to PS/2 adapter that ships with some of these is nothing more than a passive gender-bender (are we still allowed to say that?) and I would never bother with PS/2 sockets and those adapters.

    With Tachyon loaded I do all of these things that you listed without having to recompile because all the runtime routines are preloaded with plenty of room to spare. You can think of Tachyon's routines as a built-in OBEX sitting in the P1 memory. Same too with TAQOZ on P2.
  • RaymanRayman Posts: 13,861
    edited 2020-07-09 01:39
    Some qvga displays have an internal frame buffer and some don’t ...

    If it does have memory, you can do nice graphics with just P1.

    If no memory, then can do 6bpp or 8bpp color pretty nicely with tiled 2bpp driver.

    I’m pretty sure I’ve posted code for both ways here somewhere and also at Rayslogic.com.
  • Thanks!

    So let's sort things.

    1. USB HID (no I don't need and can't use PS/2 compatible hardware) - only with extra hardware
    2. Color display - only models with own memory (can anyone tell me a model)
    3. Encoders - OK.
    4. ADC ?
    5. PWM doable

    What about support of these DS3231, WS2812b and so on? are libraries available?
  • Libraries are available for the P1 for:
    DS3231 RTC
    https://forums.parallax.com/discussion/170350/ds3231-demo-missing-from-obex

    WS2812
    https://github.com/parallaxinc/propeller/tree/master/libraries/community/p1/All/Pixel Driver (WS28xx & SK68xx)

    Also, both of these have been discussed a lot on the forum, so just search here to find various examples. Same for any other common modules you want to use.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-07-09 06:58
    There have been so many peripherals and variations of peripherals that have been interfaced over the years that even if you picked one that wasn't on that list, it usually is similar to many others. Take the DS3231, that is a fairly standard I2C RTC chip that I used to use years ago and I have this one driver that basically works out if it is that chip, or a variation of it, or another similar RTC chip, and most are very similar. As for PWM, I have a cog object that handles 32 8-bit channels at 7.6kHz but there are other ones around that can may provide 8 channels at much higher frequencies etc. The WS2812 is a piece of cake, and it also has been done to death in so many ways. Same again for encoders and especially low frequency encoders are very easily handled even in high-level languages.

    As for USB HID, I don't think you get it. I'm talking about many of those USB keyboards and mice that can internally (if not advertised) select PS/2 "protocol" or USB HID. They might not come with any adapter and they might not say that they are PS/2 compatible, but there on the "USB" connector are 4 pins, 2 of which are power and the other 2 are either D+/D- or PS/2 clock+data depending upon whether it detects pull-ups or termination resistors when it is plugged into a "USB" socket.

    I have used displays in the past that had a SSD2119 driver chip that you could talk to in parallel or SPI, and they ran very well. Just look for this or for ILI9341 controller etc.
    Here's a link to a Google pubdoc which I did about 8 years ago that used one of these displays.

    BTW, ADC is normally done with SPI or I2C chips and so there is nothing special about interfacing these as many have been interfaced, the most popular being the MCP3208s etc although I always found it cheaper and better to use a $1 micro with A/D instead and load up the micro's firmware from the Prop over 1 extra programming line normally.
  • The USB keyboard,mouse and other input devices I'm going to use are not and won't be compatible with PS/2, so please no more references for that.

    For the these DS3231 and others. I know their support is simple and I've done that in picbasic for a long time ago. But I'm asking for the different thing - are libraries for such devices readily available from IDE, or I have to scroll thru the forums and search and copy-paste others code?

    For ADC, I see there is no built-in ADC in prop1, right?

  • jmgjmg Posts: 15,145
    CuriousOne wrote: »
    For ADC, I see there is no built-in ADC in prop1, right?
    Not as a native peripheral, but 2 pins and 2 resistors and caps and you have one using a timer channel.
    Or, you can make a sawtooth ADC simpler, with caveats.

  • CuriousOne wrote: »
    The USB keyboard,mouse and other input devices I'm going to use are not and won't be compatible with PS/2, so please no more references for that

    You seem to know a lot about your USB keyboards. From what I can tell, you can't tell, you have to try them. As for "please no more references for that" your first post said
    When I asked back in 2017, there were no USB keyboard/mouse libraries available, so what's going on currently, any advances?

    If you continue to be so abrupt I think you will find that the help you are asking for may not be so forthcoming.

  • CuriousOne wrote: »
    The USB keyboard,mouse and other input devices I'm going to use are not and won't be compatible with PS/2, so please no more references for that

    You seem to know a lot about your USB keyboards. From what I can tell, you can't tell, you have to try them. As for "please no more references for that" your first post said
    When I asked back in 2017, there were no USB keyboard/mouse libraries available, so what's going on currently, any advances?

    If you continue to be so abrupt I think you will find that the help you are asking for may not be so forthcoming.

    +1

    Before I read any of this thread, I knew what to expect from @CuriousOne from past experience.
  • RossHRossH Posts: 5,345
    I have no knowledge of C/C++ and so called "new" languages which use {}[];!=!X and other non logical operators, and want to avoid learning them at all costs.

    Yes, the late 70's and early 80's were great, weren't they? Truly the "golden age" of personal computing! Who could ever want anything more sophisticated than a TRS-80? :smile:
  • RossH wrote: »
    Yes, the late 70's and early 80's were great, weren't they? Truly the "golden age" of personal computing! Who could ever want anything more sophisticated than a TRS-80? :smile:
    B and C on Z80 are fun!
  • CurousOne,
    If you would like to be able to write in basic and include some spin objects, check our FlexGui over in the P2 forum. It also works on the P1.
    Jim
  • MJBMJB Posts: 1,235
    edited 2020-07-09 16:07
    There have been so many peripherals and variations of peripherals that have been interfaced over the years that even if you picked one that wasn't on that list, it usually is similar to many others. Take the DS3231, that is a fairly standard I2C RTC chip that I used to use years ago and I have this one driver that basically works out if it is that chip, or a variation of it, or another similar RTC chip, and most are very similar. As for PWM, I have a cog object that handles 32 8-bit channels at 7.6kHz but there are other ones around that can may provide 8 channels at much higher frequencies etc. The WS2812 is a piece of cake, and it also has been done to death in so many ways. Same again for encoders and especially low frequency encoders are very easily handled even in high-level languages.

    As for USB HID, I don't think you get it. I'm talking about many of those USB keyboards and mice that can internally (if not advertised) select PS/2 "protocol" or USB HID. They might not come with any adapter and they might not say that they are PS/2 compatible, but there on the "USB" connector are 4 pins, 2 of which are power and the other 2 are either D+/D- or PS/2 clock+data depending upon whether it detects pull-ups or termination resistors when it is plugged into a "USB" socket.

    I have used displays in the past that had a SSD2119 driver chip that you could talk to in parallel or SPI, and they ran very well. Just look for this or for ILI9341 controller etc.
    Here's a link to a Google pubdoc which I did about 8 years ago that used one of these displays.

    BTW, ADC is normally done with SPI or I2C chips and so there is nothing special about interfacing these as many have been interfaced, the most popular being the MCP3208s etc although I always found it cheaper and better to use a $1 micro with A/D instead and load up the micro's firmware from the Prop over 1 extra programming line normally.

    and here my not fully fleshed out TACHYON driver/experiments (from 2016 I just see) for ILI9341 SPI-LCDs based on Peter's code.
    Was working nicely for simple things without need for a display buffer.
    should get back to it soon ...
    CuriousOne wrote: »
    The USB keyboard,mouse and other input devices I'm going to use are not and won't be compatible with PS/2, so please no more references for that
    As for "please no more references for that" your first post said
    When I asked back in 2017, there were no USB keyboard/mouse libraries available, so what's going on currently, any advances?

    If you continue to be so abrupt I think you will find that the help you are asking for may not be so forthcoming.
    +1 a bit more politeness please here in the forums if you want any help from others ...
  • I think I asked a simple thing - need interaction with USB HID devices, not in PS/2 emulation mode. Anything unclear?
  • CuriousOne wrote: »
    I think I asked a simple thing - need interaction with USB HID devices, not in PS/2 emulation mode. Anything unclear?

    It's clear, but now you're potentially in the realm of a Single Board Computer if you need specific USB drivers.

    The Propeller 2 can do simple Keyboard/Mouse USB. For my own testing using a bluetooth adapter and a wireless keyboard/mouse worked very well, so things have advanced that far.
  • JonnyMacJonnyMac Posts: 8,924
    edited 2020-07-09 17:29
    I think I asked a simple thing - need interaction with USB HID devices, not in PS/2 emulation mode. Anything unclear?
    It's been made very clear that the P1 cannot interact wit USB HID devices (in the way you seem to want them), but if we're fair, most microcontrollers that can leave a lot to be desired when dealing with things on your list.
    without me using multi-level interrupts and counting clock ticks by hand, to making timings correct and ensuring everything will work
    The Propeller may not be perfect, but this is where it kicks the tar out of other microcontrollers.
    Drive these color 320x240 displays, display different text
    As has been pointed out, could be problematic for the P1 due to memory; the P2 would have an easier time.
    Read data from 2-3 quadrature encoders
    I've done that in commercial products (motion platforms for film and video cameras). The code is written in PASM and runs in its own cog; the foreground object can read and even reset the encoder values at any time. I recently wrote a P2 object that can do this for any number of encoders without needing a cog (one of the smart pin modes supports encoder inputs).
    Read data from 2-3 analog sources (8 bit precision is enough), 3-5 times per second.
    I'm sure you know, there are no ADCs in the P1; for the camera motion platform we used an external ADC appropriate for the project. The neat thing about the Propeller is that I was able to write a cog that read and did a running average of the inputs to smooth out operator bumps; running in its own cog meant that code had no impact on the mainline timing.
    Generate 3 separate PWM signals with different frequency and duty cycle (independently adjustable all)
    For the P1 you'd have to write a PASM cog, but it wouldn't be very hard work. In the P2, any pin can be a PWM output (one of the smart pin modes), and you can set it to any frequency/duty-cycle independently per pin.
    Read time from DS3231 (once per minute)
    Yep. Drop it on the I2C bus used by the P1 EEPROM and Robert is your mother's brother; you can do I2C in Spin. The P2 uses flash instead of EEPROM, so you can select any two pins you want for an I2C bus.
    Read temperature from DS18B20 (once per second)
    Yes. The timing requirements of 1-Wire mean doing it in a PASM cog with the P1, but as I just demonstrated a few days ago, you can do the same thing using inline P2ASM in the P2 (no cog required for 1-Wire).
    drive say up to 100 WS2812 leds
    I was an early adopter of "smart LEDs" (back in the WS2801 days) and may have written the first Propeller driver for them. My jm_rgbx_pixel driver for the P1 works with any 800kHz device, and gets used by a lot of lighting pros (beyond me). I also have a driver for the APA102C pixels which are popular in film and TV for their higher PWM rate.

    I think I've made my point, and I agree with Peter: there's enough of a code base that it's usually not difficult to get to where you need to go with a little adaptation. I love the Propeller, but recognize that it's not perfect for everything. Based on your hit list, I'm wondering why you're not considering a Raspberry Pi. I think it can do everything you want. You can configure it to enable 1-Wire interface through the kernel and it will automatically read the DS18b20 for you (low level stuff); I know this because I helped a friend who is a home beer brewer. Last Christmas I helped another friend with a lighting display that was controlled by an RPi, so I assume it has WS28xx drivers available, too. I know for a fact that the IO header has SPI and I2C connections.
    which is currently supported by say Arduino libraries.
    Which product in the Arduino ecosystem can do everything on your list at the same time? That seems to be your requirement for the Propeller.
    Anything unclear?
    Yes. Are you being sincere, or is this just a troll? My LA skeptical side wonders....
  • USB HID class devices are mostly input devices and differ from other devices, say printer, by using universal drivers, so most devices will work with generic, "class-based" driver. So there is no need to support all VIDs and PIDs, if device is USB HID compatible. So all I need is when say user plugs in usb gamepad, he can use it's arrow keys to move the thing. If he plugs in standard keyboard, he uses it's arrow keys to move things and so on.

    And yes, I'm doing a motion controller for filming (not a commercial project, but for myself). I do have a somehow working prototype using PIC16F887A, but I had to reduce many things - like I'm using text-only 1602 LCD display, have to use own keypad for control, instead of plugging in standard one, can run only on limited speeds, because I bit-bang driving pulses in software and so on. Btw, built-in ADC in 16F887A works brilliantly, no need for extra chips :D

    So as my understandings are, while P1 can solve some of my issues, others are remaining unsolved, and P2 maybe can help in the future, right?

    P.S. I'm really surprised and glad to see P2 in silicon, I thought it went into vaporware stage, as BitBoys OY production did :)
  • I won't comment on the specifics of what the P1 can and can not do... others on this forum are much better at that than I...
    But I might recommend you look at combining a Raspberry Pi with a microcontroller of your choice. You'll get easy support for screens, Python or any other language of your choice, and then use a serial cable for high-speed comms between the Pi and microcontroller. This would let you use the Prop (with Spin or Basic or whatever your language of choice is) for timing critical functions while the Pi takes care of the USB HID and memory-intensive tasks.
  • DavidZemon wrote: »
    I won't comment on the specifics of what the P1 can and can not do... others on this forum are much better at that than I...
    But I might recommend you look at combining a Raspberry Pi with a microcontroller of your choice. You'll get easy support for screens, Python or any other language of your choice, and then use a serial cable for high-speed comms between the Pi and microcontroller. This would let you use the Prop (with Spin or Basic or whatever your language of choice is) for timing critical functions while the Pi takes care of the USB HID and memory-intensive tasks.

    Well I have to say that I would prefer the new Maximite Colour 2. It's ARM based and runs interpreted BASIC ~270,000 lines/second. Perfect mate for the P1 and no clunky OS.
  • I can't even fathom a motion controller that only requires a quad decode of 2KHz.
    In my world, that's pretty much stopped

    Might as well forego the motor, stick a sail on it and have it toss out an anchor.
  • ErNaErNa Posts: 1,742
    Last week, running in the woods I found a huge block of gold. It was so huge, I just couldn't lift it. When I returned with a fork lift, it was no longer there... So I decided to stay with my true propeller.... and now after the advent of P2 I'm eager to see P46 and forget about the gold and P45!
Sign In or Register to comment.