+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: Binary Pin Referencing

  1. #1

    Default Binary Pin Referencing

    Hi all,

    I'm having a bit of difficulty understanding binary pin references. It's a problem I've had before and it's a problem I'd like to not have anymore, so perhaps someone could help me out a little.

    I'm trying to re-work some code to run the gadget gangster 4.3" LCD touchscreen. Currently it works by connecting the VGA pins on the device into pins 16 to 23 on my propeller, and in the code, that is referenced with '%010_111, and it has the following notes attached to it on how to change the pins around:

    Code:
    CON
      'Here is where you define the pins you use to control the 3.5" LCD
    
      BackLightPin=26
      ResetPin=12    'reset
      PixelClockPin=25
      DataEnablePin=24
      TouchIrqPin=27   'This pin is really optional, but touchscreen sets this whenever screen is touched 
      VgaPins=%010_111  'Pins 16..23  This is the same syntax as used by the VGA driver
    
      
    ''  vga_pins
    ''
    ''    bits 5..3 select pin group:
    ''      %000: pins 7..0
    ''      %001: pins 15..8
    ''      %010: pins 23..16
    ''      %011: pins 31..24
    ''      %100: pins 39..32
    ''      %101: pins 47..40
    ''      %110: pins 55..48
    ''      %111: pins 63..56
    ''
    ''    bits 2..0 select top pin within group
    ''    for example: %01111 (15) will use pins %01000-%01111 (8-15)
    I want the LCD to be connected to pins 8 to 15 (which is what they've done in the example there) but for some reason, when I change it to have the code VgaPins=%01111 it still won't work... Am I doing something wrong? The original code has an underscore in there, and the new one doesn't...

    I feel a bit silly asking about this, but it's been driving me up the wall...

  2. #2

    Default Re: Binary Pin Referencing

    The reset pin is currently defined as 12 (8 < 12 < 15). Could that be an issue?

  3. #3

    Default Re: Binary Pin Referencing

    I'm actually changing all of the pins, so that will now be pin 26 sorry about that. Should have updated that first. Nothing else will be assigned from 8 to 15.

  4. #4

    Default Re: Binary Pin Referencing

    Have you made sure DIRA is being changed accordingly?

  5. #5

    Default Re: Binary Pin Referencing

    That is an excellent point... I might try that. Though the pins aren't used for anything else before this point, won't the Propeller assign that to them automatically upon first use?

  6. #6

    Default Re: Binary Pin Referencing

    I believe nothing sets bits in dira behind your back, and no pin can output till its relevant bit is set to 1 in your cog's dir register.

  7. #7

    Default Re: Binary Pin Referencing

    I'll give that a go then.

    So can I infer from your reply that by setting VgaPins to equal %01111 it will make it use pins 8 to 15?

  8. #8

    Default Re: Binary Pin Referencing

    The driver looks OK and generates the correct vcfg value for the pins you want to use. Can you provide your complete changes (especially pin numbers)?

  9. #9

    Default Re: Binary Pin Referencing

    I'd actually prefer it if I could have binary pin referencing explained to me so that I can learn from this, rather than just be given an answer. How do they get pins 8 to 15 from a number like %01111?

  10. #10

    Default Re: Binary Pin Referencing

    Quote Originally Posted by CumQuaT View Post
    I'd actually prefer it if I could have binary pin referencing explained to me so that I can learn from this, rather than just be given an answer. How do they get pins 8 to 15 from a number like %01111?
    That's perfectly OK. But usually we find some clues in the surrounding bits (currently not shown). That said, what do your SPI pins look like? Anyway, the top 3 bits indicate the pin group (the current prop has 4 of them each holding 8 bits). The pin group is something required for video configuration. From your value we extract %001_111 which is pin group 1 (covering pins 8..15). The lower 3 bits (%001_111) indicate the top pin in the group, index runs from 0..7 which gives us base + 0..7 which in turn is 8..15.
    Last edited by kuroneko; 07-20-2011 at 07:57 AM. Reason: typo

  11. #11

    Default Re: Binary Pin Referencing

    I think I see it... So rather than putting in %01111 like the example says, I should put %001_111 to clearly define the pin group and the head pin?

  12. #12

    Default Re: Binary Pin Referencing

    %01111 is the same as %001_111. The underscore just helps with grouping specific pins and usually increases readability, e.g.
    Code:
    %00000000000010000000000000000000          ' vs
    %00000000_00001000_00000000_00000000
    So where did you put your SPI pins (which is the only other interference I can see so far)?

  13. #13

    Default Re: Binary Pin Referencing

    I'm at work at the moment and the project's at home, so I couldn't tell you off the top of my head. But I can tell you that no other pins have been assigned between 8 and 15 inclusive.

  14. #14
    StefanL38's Avatar
    Location
    northern part of Hessen (Germany)
    Posts
    2,123

    Default Re: Binary Pin Referencing

    for constant numbers you should define constants in the CON-section.

    This is a little more work when coding first but pays off as soon as you have to change the value. Yiu change it only in one single place (the constant-definition) and everything is done.
    Otherwise you have to go through the whole code changing it and you are in danger of forgetting some of them or put it to different values.

    keep the questions coming
    best regards

    Stefan

  15. #15

    Default Re: Binary Pin Referencing

    I think the problem may be the order of the pins... You cannot directly plug in the rayslogic.com (I'm assuming) 4.3" breakout board to the lower set of pins...

    The reason is that the sync signals HS and VS are on the lower pins (16,17) and on the lower row that would be (8,9). But, you can see it won't connect that way...

    You could make it work by either running jumper wires to the right spot, or changing the driver. I think either one is a pain, sorry.

  16. #16

    Default Re: Binary Pin Referencing

    @Rayman - But couldn't I just re-code the LcdDriver module to reference the correct pins? That's what I'm trying to do. The default way of hooking that board up leaves the LCD board sticking out over the edge of the Gadget Gangster board, and I need it to stack neatly on top, so to do that it needs to use pins 8 to 15 for the VGA signals, rather than pins 16 to 23

  17. #17

    Default Re: Binary Pin Referencing

    I think you could connect it to the upper row upside down, so it doesn't go over the edge.

    But, the driver would require significant modification to use the lower row...

  18. #18

    Default Re: Binary Pin Referencing

    Don't mean to hijack this but wanted to say good info here! I was a little unsure about the groups and start pins. Thanks for posting this..
    Ken N8SYG

  19. #19

    Default Re: Binary Pin Referencing

    That really sucks... My entire project is built around the ability for the boards to be able to stack like they do in the picture on Gadget Gangster, but now I find out that the LCD driver is so hard-coded that you can't have the board wired up in any other way than hanging awkwardly off the side of the development board? It'll probably just be easier to rat-nest rewire it...

    But surely there is someone who knows enough about the board or assembly to be able to help out here?

  20. #20

    Default Re: Binary Pin Referencing

    Is using the board upside down an option for you?

+ Reply to Thread

Similar Threads

  1. Trouble referencing variables from other objects to send data.
    By Michelle S. in forum Propeller 1 Multicore Microcontroller
    Replies: 1
    Last Post: 04-19-2010, 09:04 AM
  2. Referencing CON and DAT information from other Objects
    By Dave Hein in forum Propeller 1 Multicore Microcontroller
    Replies: 2
    Last Post: 03-23-2010, 03:31 AM
  3. Referencing Timing
    By clloyd in forum BASIC Stamp
    Replies: 1
    Last Post: 10-24-2008, 11:43 AM
  4. Using cognew more than once referencing the same DAT space
    By R Pankau in forum Propeller 1 Multicore Microcontroller
    Replies: 9
    Last Post: 09-27-2007, 10:20 AM
  5. fuzzy math, referencing, and exchanging information
    By Archiver in forum BASIC Stamps Archive
    Replies: 6
    Last Post: 11-27-2001, 12:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts