Shop OBEX P1 Docs P2 Docs Learn Events
I'm new and have a few questions — Parallax Forums

I'm new and have a few questions

kittmasterkittmaster Posts: 77
edited 2007-12-06 04:34 in Propeller 1
I was turned on to this device not more than 5 hours ago in a quest to do a very specific function.

I have an application that is already fundamentally and physically built on an 8051 platform. I've spent a lot of time and effort to get it completed and debugged.

Ok nuff of that:

My goal is to have my 8051 feed an ascii serial stream of data from its serial port to a "device" that can interpret the serial stream and the put it onto a CRT/LCD through composite video connection. The person that referred me after explaining my platform, told me his IC could do it, but I'd really like this propeller chip due to the speed, power, color etc etc.

I've downloaded the software and looked at the tv.spin and the simple serial.spin. I must admit, I have no idea where to go from here or how to link these two modules together to achieve my goal. I've looked at several examples. I don't understand how to draw the information onto the tv area or how to have the serial stream and parse the data. Is there any way to draw borders or to shape the TV display data? I didn't see any way to do that.

Also, how do you get this to run at 80MHz? I've yet to see a xtal beyond 20Mhz???

If these are noob questions I applogize, I just don't have the motivation to learn another complete language from the ground up (yet). I really like what I see with the propeller, just looking for a quick A to B fix for this issue.

Can anyone point me in the right direction?

Thank you

Chris

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-06 01:45
    You will have to learn Spin (the Propeller's high level language). Start by downloading some of the Propeller Education Kit tutorials from this forum (see the "sticky" threads at the top of the thread list). You will need to download the Propeller Manual if you haven't done that already and the Propeller Tool.

    I'm assuming that you want a text display. If so, there's an object called tv_text.spin that takes an ASCII string and displays it on the video screen and interprets some control codes to do things like row and column positioning and setting the current color(s). If you want complex borders or graphics, there's a separate graphics driver that also handles vector-based text. All of these drivers include demo programs that are included with the Propeller Tool.

    The Propeller has a PLL (phase locked loop) in its clock circuitry that can multiply the crystal oscillator frequency by powers of 2 up to 16, so a 5MHz crystal becomes an 80MHz system clock. The Hydra and the SpinStamp use a 10MHz crystal x 8 to get the same system clock frequency.

    There's not a super quick A to B fix for this. It will take some coding on your part. If the "interpret"ing is not too complex, I suspect this might take one to two pages of code to do.

    In terms of hooking the serial I/O and display I/O modules together, there's a serial input routine that gives you the next character received and there are two display routines, one that takes a single character and writes it to the current display position and another that takes a string (zero terminated) and writes it to the display interpreting any control characters as it goes. There are also routines to take numbers and display them as decimal or hexadecimal data.
  • kittmasterkittmaster Posts: 77
    edited 2007-12-06 02:27
    I've downloaded all those documents and still trying to get through all of it. I don't mind spending the time, it seems the payoff is going to be well worth it.

    I'm just not understanding the object usage aspect. Like in VB, you'd place the text button, click on it, then write your code.

    What I don't understand is how to link all of it together, assign the pins??? Does the programming assume that your using the pins as defacto in the demo board?

    How does one debug the code that they write, just follow the compiler errors?

    I guess I'll reread your section and try to connect all the dots.

    I will order one chip tomorrow and create a CNC PCB prototype to test......this is how I feel right about now.....> confused.gif

    LOL

    Thanks for the fast response.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-06 02:58
    The TV_Text_Demo.spin file shows how easy it is to display text, it's really short so I'll reprint it here:

    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    OBJ
      text : "tv_text"
      
    PUB start | i
      'start term
      text.start(12)
      text.str(string(13,"   TV Text Demo...",13,13,$C,5," OBJ and VAR require only 2.8KB ",$C,1))
      repeat 14
        text.out(" ")
      repeat i from $0E to $FF
        text.out(i)
      text.str(string($C,6,"     Uses internal ROM font     ",$C,2))
      repeat
        text.str(string($A,16,$B,12))
        text.hex(i++, 8)
    

    The CON block·configures the system clock, the OBJ block includes the tv_text object for use. The text.start initializes the object and indicates to output on 4 continous pins starting at pin 12, the circuit for the TV connection is availible on the Demo Board schematic located in the Diagrams,Schematics, and Images page. The text.str shows how to display static text, including ASCII control characters to the display. The section between the two text.str displays the entire built in font to the screen. The text.hex displays the incrementing variable as a hexadecimal of 8 characters long.
    So it's not a difficult proposition to write a simple program where the program checks serial input and display it to the screen, in fact it's was easy enough to write a dumb terminal program that I wrote one:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      TXPIN = 0
      RXPIN = 1
      SERMODE = %0000
      BAUD = 9600
    
    OBJ
      text : "tv_text"
      serl : "FullDuplexSerial"
    PUB start 
      'start term
      text.start(12)                         'start TV on pin 12 through 15
      serl.start(TXPIN,RXPIN, SERMODE, BAUD)
      repeat                                 'forever
        text.out(serl.rx)                    'wait for a byte to be received serially and output the value to the screen
    

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 12/6/2007 3:40:59 AM GMT
  • kittmasterkittmaster Posts: 77
    edited 2007-12-06 03:21
    oh my......thats all it takes?

    the simplier fiels aer starting to make a bit of sense. I understand the con thing now and the xtal multiplier.....just like a normal computer, with cpu multipliers.....> done

    I guess the code you wrote will be the minimum framework I can use to get started. I'll be ordering the chip tomorrow and will link up the serial output of my 8051 to the IC and code you provided. I hope that does the trick. Seems easy, I just wish I completely understood the spin language......and the formatting syntax. That will come with time I guess......thanks for the help......[noparse]:)[/noparse]

    Chris
  • kittmasterkittmaster Posts: 77
    edited 2007-12-06 03:25
    how would i handle things like carriage returns when the string is completed. Do I need a delimiter monitor for that? Eitehr way, i'll most likely have to wait to get the hardware to play with it a bit.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-06 03:30
    an ASCII character $0D (carriage return) is interpreted correctly and advances to the next line.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-06 03:33
    Don't forget that you need a few components more than the Propeller chip itself like an EEPROM and a crystal (usually 5MHz) and some kind of 3.3V TTL to serial adapter for programming. You'll need some resistors with specific values. Consider getting a USB PropStick which has the crystal, EEPROM, 3.3V voltage regulator all on a 40 pin DIP substrate with a mini-USB connector and USB to serial adapter for programming, and brings all the I/O pins out to the lead frame. All you'll need is the 3 resistors for the TV output DAC and a 1K resistor from the 8051 transmit output to whatever Propeller input you use (if you're powering the 8051 from 5V ... The 1K resistor protects the Propeller's 3.3V input from the 5V signal). You can also use the USB to serial adapter to send debug information to a terminal emulator on the PC like HyperTerm or a program you can find here called PropTerm.

    If you're getting something like the Propeller Demo Board, it will include the TV interface and the USB to serial adapter (and a 5V and 3.3V regulator). You'll still need the 1K resistor between the 8051 and the Propeller.

    Post Edited (Mike Green) : 12/6/2007 3:38:35 AM GMT
  • kittmasterkittmaster Posts: 77
    edited 2007-12-06 03:45
    
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      TXPIN = 0
      RXPIN = 1
      SERMODE = %0000
      BAUD = 9600
    
    OBJ
      text : "tv_text"
      serl : "FullDuplexSerial"
    PUB start | i
      'start term
      text.start(12)                         'start TV on pin 12
      serl.start(TXPIN,RXPIN, SERMODE, BAUD)
      repeat                                 'forever
        text.out(serl.rx)                    'wait for a byte to be received serially and output the value to the screen
    



    Just a couple of questions on the code

    Why did you put the | i > is that supposed to be an argument return? And for what?
    Where is the documentation for the SERMODE and what are the other options for it? No returns in the forum about it
    How do I find out how the object is supposed to be analyzed? Does the tv_text know the 3 pins that create the outputs with the 3 resistors?
    So many questions.....sorry
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-06 03:52
    The | i· was in error, left over from the original code, it's a declaration of a local variable i (but my code doesn't use it).

    the sermode is outlined in the object FullDuplexSerial.spin, here's a reprint:

    '' mode bit 0 = invert rx
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx
    
    

    It's the 3 consecutive pins starting with the number specified (12,13,14)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • parts-man73parts-man73 Posts: 830
    edited 2007-12-06 03:57
    Kittmaster said...
    Does the tv_text know the 3 pins that create the outputs with the 3 resistors?

    the line
    text.start(12)                         'start TV on pin 12
    



    is where you specify which pins to use for the TV output. In this case it is pin 12, and the next 2, so pins 12-14 are used.

    One note..... My SpinStudio hardware can get you up and running with composite video. And now the Main Board includes a Propeller and an EEPROM for no extra cost. I was going to announce that to the forum members in the next day or 2, I am just waiting on a shipment of Propellers from Parallax. All you would need is a PropPlug to program it. Or, the EEPROMs ship pre-loaded with PropDOS. You can compile programs to a binary file, save to an SD card, and load/run with PropDOS, no PropPlug required.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio

    PropNIC - Add ethernet ability to your Propeller!

    SD card Adapter
  • kittmasterkittmaster Posts: 77
    edited 2007-12-06 04:01
    Mr Green

    Thank you for the addition information. I'll be ordering the chip tomorrow, I have all the components to properly replicate the demo board schematic which I assume is absolute at this point with no errata.

    The code snippet and the addition info was very helpful. I was reviewing the quick reference sheet for spin and asm and it seems pretty straight forward. Just not used to "starting" and object....

    I'm VERY excited about this aspect of my project, it looks like it will be a perfect fit and a lot of support around this platform..... cool.gif
  • kittmasterkittmaster Posts: 77
    edited 2007-12-06 04:14
    Paul Baker (Parallax) said...
    The | i was in error, left over from the original code, it's a declaration of a local variable i (but my code doesn't use it).


    the sermode is outlined in the object FullDuplexSerial.spin, here's a reprint:





    '' mode bit 0 = invert rx
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx
     
    
    


    It's the 3 consecutive pins starting with the number specified (12,13,14)

    I peeked into that fullduplex file and didn't see SERMODE but I did see the excerpt, I see how the four bits are represented as %0000 but it doesn't make sense how it references those bits from that object file since there is no similiar caller name to the function "SERMODE". Maybe it'll click later on. Thanks
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-06 04:20
    sermode is just the name I provided the constant %0000

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • kittmasterkittmaster Posts: 77
    edited 2007-12-06 04:34
    ok that makes sense.....
Sign In or Register to comment.