CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC4FJ128GA204 Parallel Master Port Data Access

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mdemuth



Joined: 16 Apr 2007
Posts: 71
Location: Stuttgart, Germany

View user's profile Send private message Visit poster's website

PIC4FJ128GA204 Parallel Master Port Data Access
PostPosted: Mon Oct 10, 2016 6:25 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 10, 2016 6:57 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Mon Oct 10, 2016 7:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 10, 2016 8:09 am     Reply with quote

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()!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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