|
|
View previous topic :: View next topic |
Author |
Message |
mdemuth
Joined: 16 Apr 2007 Posts: 71 Location: Stuttgart, Germany
|
PIC4FJ128GA204 Parallel Master Port Data Access |
Posted: Mon Oct 10, 2016 6:25 am |
|
|
Hello I am trying to use the PMD0..7 to simply write data to an LCD.
Code: |
int8 counter8= 0;
void main()
{
setup_oscillator(OSC_INTERNAL,64000000,8000000);
setup_wdt(WDT_1S);
setup_psp (PAR_ENABLE, 0x00FF);
while(true)
{
counter8++;
printf("\n\rI am ALIVE! %03U", counter8);
psp_write (counter8); //
delay_ms(100);
restart_wdt();
}
}
|
The loop stops after 5 runs, looks like the stack is full and nothing can be seen on pins PMD0..7
(Compiler Version is 5.026)
Question:
How does the minimum setup for the PMP looks like? I only want to use is as an 8 bit wide port with direct access.
How can the data be shifted out to the pins?
Last edited by mdemuth on Mon Oct 10, 2016 7:01 am; edited 1 time in total |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Mon Oct 10, 2016 6:57 am |
|
|
I don't have enough PMP experience to give you a potted minimal set-up. I've only recently started working on the PMP myself, and its not turning out to be a easy experience.
Writing data using the PMP is easy. Using it to talk to an LCD appears to be a pretty standard example application, indeed almost the only sample application, whihch is telling as it usually requires no reading of data. Searching for PMP and LCD on this forum will pull up some useful info, as will Googling the same terms.
One big hint: you want to be using PMP, i.e. master, functions, not PSP functions, which are for slaves.
Getting the timing right is another thing to get right, and didn't work as I expected. It's okay now that I've got my head around it. You will need to read and understand the datasheet for your LCD driver for a start.
Reading is quite a different matter: much more difficult, but not needed for most LCD applications.
The PMP will not save you much for most LCD applications. With 24s you can bit-bang an LCD pretty fast - all you will need are your data lines and a write strobe. It with larger and more frequent data access, particularly blocks, where hardware such as the PMP really score, especially when they can be used with DMA, but its complex to get working, as I'm finding to my cost. |
|
|
mdemuth
Joined: 16 Apr 2007 Posts: 71 Location: Stuttgart, Germany
|
|
Posted: Mon Oct 10, 2016 7:04 am |
|
|
Code: |
setup_psp(PAR_ENABLE | PAR_PTBE1EN_ENABLE | PAR_PTBE0EN_ENABLE ,0x00FF); //Sets up Master mode with address//lines PMA0:PMA7
| gives the same result.
and:
Code: |
setup_pmp(PAR_ENABLE | PAR_PTBE1EN_ENABLE | PAR_PTBE0EN_ENABLE ,0x00FF); //Sets up Master mode with address//lines PMA0:PMA7
| gives the same result.
Last edited by mdemuth on Mon Oct 10, 2016 8:17 am; edited 1 time in total |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Mon Oct 10, 2016 8:09 am |
|
|
Quote: | //Sets up Master mode with address//lines |
No it doesn't. It sets up slave mode! You are using psp functions instead of pmp ones! Use setup_pmp()!! |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|