Shop OBEX P1 Docs P2 Docs Learn Events
Display.spin on HYDRA — Parallax Forums

Display.spin on HYDRA

CoolguyCoolguy Posts: 26
edited 2007-10-09 17:08 in Propeller 1
Hello,

I have a problem when trying to run an example code Display.spin from Propeller Manual page 139 on the HYDRA. I've modified the clock frequency to 10_000_000 and _clkmoce to xtal2. Also, modified TV.Start(12) to TV.Start(24) as the HYDRA video start at P24. I download this code and nothing happen on the TV. I've ran many demo program from HYDRA so I knew my hardware is good. Any suggession please!

Here is my modified code:


{{ Display.spin }}
CON
· _clkmode = xtal2 + pll16x
· _xinfreq = 10_000_000
OBJ
· Num : "Numbers"
· TV : "TV_Terminal"
PUB Main | Temp
· Num.Init 'Initialize Numbers
· TV.Start(24) 'Start TV Terminal
· Temp := 900 * 45 + 401 'Evaluate expression
· TV.Str(string("900 * 45 + 401 = ")) 'then display it and
· TV.Str(Num.ToStr(Temp, Num#DDEC)) 'its result in decimal
· TV.Out(13)
· TV.Str(string("In hexadecimal it's = ")) 'and in hexadecimal
· TV.Str(Num.ToStr(Temp, Num#IHEX))
· TV.Out(13)
· TV.Out(13)
· TV.Str(string("Counting by fives:")) 'Now count by fives
· TV.Out(13)
· repeat Temp from 5 to 30 step 5
··· TV.Str(Num.ToStr(Temp, Num#DEC))
··· if Temp < 30
····· TV.Out(",")

Comments

  • BaggersBaggers Posts: 3,019
    edited 2007-10-08 14:41
    Coolguy

    Your problem is _clkmode is set to xtal2 + pll16x and _xinfreq = 10_000_000, that would make it run at 160Mhz, which would fail, as instructions start failing at roughly 112Mhz according to tests conducted by parallax.

    Try setting _clkmode to xtal2 + pll8x

    This should fix your problem.
  • CoolguyCoolguy Posts: 26
    edited 2007-10-08 14:58
    WOW! that is amazing. Thank you very much Baggers!

    Can I ask you another question? I know Propeller has a buit-in font. The font contains schematic symbols. Can you help me write the code to draw simple schematic on the TV? Just resistor, diode, capacitor, ... (doesn't have to be a schematic, just be able to display electronic component symbols on the TV screen). Example code please.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-08 15:18
    The schematics you've seen using the Propeller font are all hand drawn using either the Propeller Tool or some other kind of editor since the same font is distributed with the Propeller Tool. The Propeller manual has the font table printed in it and the Propeller Tool can display several different tables of the font.

    To display the characters on a TV screen, you need to use tv_text.spin or any other text display driver that uses the built-in font. You need to know what the character codes are for the symbols you want and you need to know how you want them laid out on the display screen. You use the out or str method of the tv_text driver to display the characters you want on the screen. Have a look at the tv_text_demo.spin for examples of the calls. All three programs (tv.spin, tv_text.spin, and tv_text_demo.spin) are included when you install the Propeller Tool.
  • BaggersBaggers Posts: 3,019
    edited 2007-10-08 16:14
    No Probs, Coolguy

    PS, if you open the Propeller Tool,
    And in your modified program above

    add the following line to the end.
    TV.Str(string(""))

    Then put the cursor between the quotes "" then click on the Help menu, then click View Character Chart
    You can then click on the characters in the newly pop'd up dialog box showing the Propeller Font, this will then automatically put the characters into the quotes.

    You can then compile and run it, and enjoy [noparse];)[/noparse]

    Baggers.

    Mike, Sorry to have added more to your explaination ( I don't like stepping in on your replies, but thought if I showed how to, with simple instructions it might help him and other newbies )
  • CoolguyCoolguy Posts: 26
    edited 2007-10-08 16:36
    Thanks again Baggers. That is exactly what I'm looking for. A simple straight instruction. Thank you, thank you. I'm sure this will help other newbies as well.

    Can I ask one more question?

    Parallax has all this nice drivers that come with the complier. Where can I find the documentation describe how to access them or what it is doing? Do I have to manually go to the code to understand each of the driver? Usally Parallax has very nice documents for all of their products. Is it the same in this case, but I just can't find it? Please advise.



    Coolguy
  • HarleyHarley Posts: 997
    edited 2007-10-08 17:17
    Thanks Baggers

    Nothing like having a simple straight instruction. Hadn't seen this explained before; probably was searching for something else more important at the time.

    I'd guess there are quite a few who've not known this. Thanks so much.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • BaggersBaggers Posts: 3,019
    edited 2007-10-08 19:00
    No Probs for the tips guys [noparse]:)[/noparse]

    Coolguy, It all depends really on how deep you want to go into the driver, if you know, or want to know about generating a TV display, and the timings for each of the sections ( Horizontal Sync, and Vertical Sync, Colour bursts, and front and back porches, ) then you can read Andre's book, that comes with the Hydra, or if that's too technical, and you just want to know how to use the display driver to show text, then as Mike Green stated in his post about tv_text_demo.spin, that has a quick demo to show you the set up and usage of the driver.

    But you have it in your example above

    TV.Start(24) 'Start TV Terminal
    'Starts the TV terminat object in another cog, using pins 24,25,26 and 27 ( 27 when using broadcast mode )

    TV.Str(string("900 * 45 + 401 = "))
    ' sends a string to the current cursor position of the TV driver.
    ' eg, TV.Str( string("hello world") ) has a buffer holding "hello world" and the string() part tells the prop tool to reference the address of where the string is, as the function TV.Str() requires a pointer to Humram where a string is held.
    ' TV.Out(13) sends ascii character 13 to the driver, which happens to be carriage return / enter / whatever you want to call it.

    There are some other ascii codes, like 10 and 11, are set X and Y screen position with next sent byte.
    eg.
    TV.Out(10)
    TV.Out(0)
    TV.Out(11)
    TV.Out(0)
    Will send the cursor to the top left of the screen, so any other Str or Out characters will be displayed at the top left of the screen
    you can even use variables like
    TV.Out(10)
    TV.Out(X)
    TV.Out(11)
    TV.Out(Y)
    etc.

    Hope this helps, but like I said, it depends on what you know already, and how deep you want to go into what's happening with the driver.
    They are done, to help new users, who have no idea about composite screen generation timings, to be able to generate a tv image from a microcontroller.

    PS. sorry if I seem to waffle lol
    Baggers.
  • CoolguyCoolguy Posts: 26
    edited 2007-10-08 19:55
    Baggers,

    I tried your technique about the Character Chart. I putted some resistors and inductors on the string. I complied and run the code, none of those characters show up on the screen. Any advise?

    About the drivers, I want to know the following:

    - What are the built-in drivers availible from Parallax?
    - What is each driver do?
    - What are the parameters for each driver?

    I'm looking for a simple documentation of what do I need to access the driver object. For example, I want to change the color of my text. Is the driver has any document telling me how to do that or I have to go to the whole driver and understand it.

    Thanks again,
    Coolguy
  • BaggersBaggers Posts: 3,019
    edited 2007-10-09 07:58
    Hi Coolguy,
    Sorry, I should have added that you need to change

    TV : "TV_Terminal"

    to

    TV : "TV_Text"

    because that uses the rom font.

    As for changing colours, with this driver, there are 8 preset colours.

    ······················· '······ fore·· back
    ······················· '······ color· color
    palette···············byte··· $07,·· $0A··· '0··· white / dark blue
    ······················· byte··· $07,·· $BB··· '1··· white / red
    ······················· byte··· $9E,·· $9B··· '2·· yellow / brown
    ······················· byte··· $04,·· $07··· '3···· grey / white
    ······················· byte··· $3D,·· $3B··· '4···· cyan / dark cyan
    ······················· byte··· $6B,·· $6E··· '5··· green / gray-green
    ······················· byte··· $BB,·· $CE··· '6····· red / pink
    ······················· byte··· $3C,·· $0A··· '7···· cyan / blue

    you can add a palette section to your main program, in a dat section then set the colours by
    · TV.setcolors(@palette)

    and to select a colour
    · TV.out(12) ' this tells the tv object to use the next byte sent as·an offset to which colour to use, 0 = white on dark blue, 1 = white on red, 2 = yellow on brown etc. to 7 = cyan on blue. unless you've changed the palette obviously.
    · TV.out(0)·· ' change the 0 to any one of the 8 palettes ( ranging 0 - 7 )

    Hope this helps.


    Post Edited (Baggers) : 10/9/2007 8:07:17 AM GMT
  • CoolguyCoolguy Posts: 26
    edited 2007-10-09 15:25
    Baggers,

    I'll try that. Thanks again for your help.

    This is exactly what I'm talking about. How do I know how many object drivers are available from Parallax? (OK I could just look at the directory and find out). However, what more important is what are they use for and what parameters that it need. Like you just shown me is a good example, without previous knowledge or documentation I wouldn’t know to use “TV_Text”. If some how someone tell me that the “TV_Text” object would do the job. How do I know to choose TV.setcolors? Also what are the available parameters? Are there documentations on these or I just have to study the code? Bottom line is I just want to use these object as a client. I don’t want to understand what inside the object.

    Thanks,
    Coolguy
  • BaggersBaggers Posts: 3,019
    edited 2007-10-09 15:31
    Coolguy,

    I guess there isn't a definitive These are the current objects/drivers and these are there functions lists.

    I currently don't have time to do a beginners list to what's what and what's where and what does what list.

    But, if there's someone else out there, who does want to start it, I guess people could add it to the wiki?

    Baggers.
  • CoolguyCoolguy Posts: 26
    edited 2007-10-09 15:50
    NO no no Baggers. Please don’t get me wrong on this. I’m not expecting you to write the documentations or tell me everything about every object. All I’m asking is do you aware of any documentation out there that I might have just missed. If not, then it is just an idea for Parallax or someone who interested to put this useful information together. I’m sure it will be greatly appreciate for most of us. I agreed with you the wiki is probably the best place to put.

    I’m appreciating your help so far. It is the most value thing for leaning.

    Thanks again,
    Coolguy
  • BaggersBaggers Posts: 3,019
    edited 2007-10-09 17:08
    Don't worry Coolguy, I hadn't misread you, I was just thinking aheadm IE, yes it would be a good idea to have documentation with examples on how to set up stuff, and what functions are available for the objects, etc. as this would help you and others on how to use and make the most of their propeller.

    No probs,
    Baggers.
Sign In or Register to comment.