Shop OBEX P1 Docs P2 Docs Learn Events
Using P31 after initialization — Parallax Forums

Using P31 after initialization

Vega256Vega256 Posts: 197
edited 2012-07-28 21:40 in Propeller 1
Hi guys,

It turns up that all of my Prop pins are booked...except for the last four pins. I need more pins (at least one), but initialization signals really mess things up when my circuit is powered on. I am trying to use P31, but I don't think it's working the way I had thought it would work.

P31 is an input during initialization; it receives from the PC. The line I want connected to it is an output which is initially LOW.

Wouldn't the Prop take that to mean that there no PC connected, and to just continue loading from EEPROM?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-28 13:05
    Yes, P31 low means that there's no PC talking to the Propeller since this is a normal serial input which idles at high. There is a timeout involved ... You'd have to look at the published ROM bootloader to see how much time is involved. How are you going to handle debugging your hardware and software? Best thing would be to have a jumper that selects P31 between your sensor and a programming connector. Alternatively, you could use an OR gate, whether an IC or a diode OR with a pulldown.
  • Vega256Vega256 Posts: 197
    edited 2012-07-28 13:15
    Mike Green wrote: »
    Yes, P31 low means that there's no PC talking to the Propeller since this is a normal serial input which idles at high. There is a timeout involved ... You'd have to look at the published ROM bootloader to see how much time is involved. How are you going to handle debugging your hardware and software? Best thing would be to have a jumper that selects P31 between your sensor and a programming connector. Alternatively, you could use an OR gate, whether an IC or a diode OR with a pulldown.
    Ah, thanks, Mike. It could be a problem with my code, too. I'll chime back in later.
  • Vega256Vega256 Posts: 197
    edited 2012-07-28 13:47
                  mov       address, ina                      'Obtain the address and data 
                  mov       data, ina
                  mov       temp, ina
    
                  shr       temp, #17
                  and       temp, addressFilter2        
                                        
                  shr       address, #8                       'Adjust address to proper position
                  and       address, addressFilter            'Filter out unwanted pin states
                  or        address, temp
                                    
                  and       data, dataFilter                  'Filter out unwanted pin states
    
    storeData
                  add       baseAddress, address            'Obtain the indexed address
                  wrbyte    data, baseAddress                      'Write data to the indexed address
                  xor       outa, wait_pin
                  waitpeq   cs_pin, cs_pin                      'Wait until chip select signal goes inactive
                  jmp       #monitor
    
    This is an excerpt from a program. Connected to the Prop [P8-P21] are address lines [A0-A13]. I need one more line [A14] to get fed to the Prop (hopefully through P31...). Because A14 won't come after A13 on the Prop, I guess I have some bit shifting to do. With A14 connected to P31, this is the code I have. Should 'address' hold the correct address after the shifting and masking?
  • kuronekokuroneko Posts: 3,623
    edited 2012-07-28 17:25
    Vega256 wrote: »
    This is an excerpt from a program. Connected to the Prop [P8-P21] are address lines [A0-A13]. I need one more line [A14] to get fed to the Prop (hopefully through P31...). Because A14 won't come after A13 on the Prop, I guess I have some bit shifting to do. With A14 connected to P31, this is the code I have. Should 'address' hold the correct address after the shifting and masking?
    Logic looks OK. If you can afford to use flags (carry that is) may I suggest another way?
    mov     address, ina                                                   
                    mov     data, ina
    [COLOR="silver"]'{opt, wrbyte}  and     data, dataFilter                ' Filter out unwanted pin states[/COLOR]
    
                    shl     address, #10 wc                 ' align with MSb, carry := address[31]
                    rcr     address, #1                     ' collect A14
                    shr     address, #17                    ' Filter out unwanted pin states
    
    This gets rid of all three filter masks (dataFilter is not required due to wrbyte usage) and some code.
  • Vega256Vega256 Posts: 197
    edited 2012-07-28 21:40
    kuroneko wrote: »
    Logic looks OK. If you can afford to use flags (carry that is) may I suggest another way?
    mov     address, ina                                                   
                    mov     data, ina
    [COLOR=silver]'{opt, wrbyte}  and     data, dataFilter                ' Filter out unwanted pin states[/COLOR]
    
                    shl     address, #10 wc                 ' align with MSb, carry := address[31]
                    rcr     address, #1                     ' collect A14
                    shr     address, #17                    ' Filter out unwanted pin states
    
    This gets rid of all three filter masks (dataFilter is not required due to wrbyte usage) and some code.
    Thanks, kuroneko. That looks to be much better.
Sign In or Register to comment.