Binary Pin Referencing
CumQuaT
Posts: 156
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:
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...
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:
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...
Comments
So can I infer from your reply that by setting VgaPins to equal %01111 it will make it use pins 8 to 15?
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
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.
But, the driver would require significant modification to use the lower row...
But surely there is someone who knows enough about the board or assembly to be able to help out here?
I may take another look to see how difficult it would be to change the driver...
It is probably possible to modify other VGA drivers (although maybe not as easily).
There's one main issue... The SCL and SDA signals are then on P2 and P3. You can't use the PropPlatforms SD card, if you have one, due to pin conflict.
<strike>Also, you'll have to add 10k pull-up resistors to SDA and maybe SCL.</strike>
It might be better to jumper SCL and SDA back over to pins P28 and P29.
Just don't try to use an SD card on P0..P3 at the same time...
Also, you may not need to add pull-up resistors in the I2C pins (but it would still be a good idea).