Shop OBEX P1 Docs P2 Docs Learn Events
question about PASM trying to decipher pin numbers — Parallax Forums

question about PASM trying to decipher pin numbers

mikedivmikediv Posts: 825
edited 2010-03-27 11:26 in Propeller 1
Hi guys I am looking at the TV.spin program that comes with the prop tool I am trying to change the composite TV pins to match a board I have I am using pins 16-19 the prop demo board uses 12-15

I found where the value is stored however the TV.spin uses assembly language so I have this


pins0 long %11110000_01110000_00001111_00000111
pins1 long %11111111_11110111_01111111_01110111


can some one please tell me how I can change that to match my pins of 16-19 how can I convert this binary to dec I just tired loading it into a scientific calculator then changing from bin to dec but that didn't work lol

thanks

Comments

  • SapiehaSapieha Posts: 2,964
    edited 2010-03-26 02:33
    Hi mikediv


    pins- Numb- 33222222_22221111_11111100_00000000 'Pin Number - 10 number + -

    10987654_32109876_54321098_76543210 '- - 1 number, If You count from 1 add 1 to that number.

    pins0 long %11110000_01110000_00001111_00000111
    pins1 long %11111111_11110111_01111111_01110111


    Regards

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • kuronekokuroneko Posts: 3,623
    edited 2010-03-26 02:40
    I don't exactly see how convertion to decimal would help. Binary is the closest/best you can get in terms of pin assignments.

    Anyway, all that isn't exactly necessary. One of the parameters used to start TV.spin is the pin group. Have a look at TV_Text.spin and its tv_pin parameter (described in more detail in TV.spin). It's derived from the base pin (12 for the demoboard). Let it do the calculation for 16 and go from there.

    basepin 12: $15 tv_pin value
            16: $20
    

    Post Edited (kuroneko) : 3/26/2010 2:47:39 AM GMT
  • mikedivmikediv Posts: 825
    edited 2010-03-27 01:12
    Sapieha thank you sir,, kuroneko your are absolutely correct the only thing I want to do is change the NTSC pins to work with my proto board that have the TV pins on 16-19 I was just guessing with my request since that was the only part of the code
    I could identify ,, would you be able to point out to me where I could change the values in the TV.spin driver so I could use TV pins 16-19 instead of the 12-15.. I would be very thankful

    I can not find basepin 12: $15 anywhere in the code
  • kuronekokuroneko Posts: 3,623
    edited 2010-03-27 02:05
    mikediv said...
    ... would you be able to point out to me where I could change the values in the TV.spin driver so I could use TV pins 16-19 instead of the 12-15
    What I meant is this, at some point you have to start the TV driver with a parameter block (14 contiguous longs). The third one is tv_pin and if you want to use pins 16-19 then this value has to be $20 (look at how TV_Text.spin sets up this parameter (method start, line 56)). The values I listed where just that, values. The demoboard will use $15, you'd have to use $20.

    TV.spin doesn't use a hard-wired pin assignment. It's up to the caller to tell it what to use.
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2010-03-27 07:38
    Maybe you're using a two-tier approach, but it might be worth·referencing the straightforward three-tier approach that the combination of tv, tv.text and tv_text_demo uses (at least as found in 1.2.7 (R2) of the Propeller tool, if not earlier).·

    [noparse][[/noparse]1] tv:· the mostly assembly code hardware driver·doing the low-level tv signal generation (loads in new cog)
    [noparse][[/noparse]2] tv_text:· the spin code·high-level software driver for making and using the text buffer (spin interpreter)
    [noparse][[/noparse]3] tv_text_demo:· the short spin code "user" program of the preceding two tiers (also ran by spin interpreter)

    I think this three-tiered approach has good organization, though one can certainly combine the two top tiers.

    Due to the way the tv_text "middleware" is written, the tv_text_demo user program just needs to issue a "start" call to tv_text using:· text.start(basepin), assuming a tv_text object was declared in the OBJ section with text: "tv_text" and wherein basepin is replaced by the desired base pin number.· I've used this with base pins 0, 12 (the default) and 16, and they all work (two different dev. boards).· Then, tv_text will start the tv driver, and the tv driver will launch its own assembly code into a new cog.· So, though using a three-tiered approach, the combination·only uses two cogs (one cog for the interpreter·running tv_text & tv_text_demo and a another (new cog)·for tv).·

    The bit of actual conversion magic that pulls off calculating the value for the third parameter (tv_pins) of the tv object's required 14 is found in the tv_text middleware's public start method:
    tv_pins := (basepin & $38) << 1 | (basepin & 4 == 4) & %0101.·

    Note that it uses·the basepin passed into it upon starting it from the tv_text_demo user.· Perhaps there's something there that might be useful to you (though you could, of course,·just focus on the tv driver itself).

    I haven't actually thought about this line of code or looked at the low-level tv driver to see if there are any "rules" limiting pin usage.· However, for example, when using pin 0 as the base pin for the above three-tiered approach, one can start tv_text by sending it 0, 1, 2 or 3 as the basepin (4 would be "out-of-range," though).·


    Post Edited (JRetSapDoog) : 3/27/2010 7:46:04 AM GMT
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2010-03-27 11:26
    Look in tv_text.spin to see how it does it.

    It makes a table of parameters which are sent to tv.spin and these include the pin assignment

    There is absolutely no need to hack tv.spin

    Graham
Sign In or Register to comment.