Dear Ttelmah,
I also set the address as you showed in earlier post. It was real easy. Thanks!
There are still many uncertain factors in 18F family for PMP functions in CCS. I am hesitating whether I should use this chip or not in this PMP project.
I mounted the new PCB with PIC24FJ128GB108 chip just now, and edit a small codes for test:

Now I can fetch the signal change at WR/RD pins and Address/Data port. But strange things are: 1. Signal at RD pin is reverse (low active). 2. No signal at CS0/1 pins. 3. Device stops there after several minutes, then goes on, repeat this operation.
No watch dog timer used here.

For issue-1:Signal at RD pin is reverse (low active), this is caused by the Master Mode 1, if select Master Mode 2, nothing at both WR and RD pins. I get this result on both 18s and 24s chips, strange!

norman_tan

Joined: 30 Jan 2008Posts: 21

Posted: Mon Dec 18, 2017 12:43 am

Dear Ttelmah, RF_Developer and PCM programmer,
I finally can control the PMP(Master Mode 2, for 18s I used the original method, for 24s I used functions as SETUP_PMP) well now after studying the manual carefully again and again! I think I must report it to you all. Thank you very much!

After have changed some settings for those registers all signal at WR, RD, CS, IRQ pins, DATA port, Address Port can be fetched with an oscilloscope. They are working as expected.

Here I attach the settings for 18f87j11 family:

Code:

// Init the Parallel Master Port as Master Mode 2:
// PMCS1 and PMCS2 function as chip select, CS2P/CS1P/WRSP/RDSP active-high
// PMA15 and PMA14 function as PMCS2 and PMCS1 - this set is important! or else no signal at these 2 pins
// Master Mode 2 (PMCSx, PMRD, PMWR, PMBE, PMA<x:0> and PMD<7:0>)
// 8-Bit mode: Data register is 8 bits
// Interrupt is generated at the end of the read/write cycle
// PMA<12:0> function as PMP address lines(PMA13 ignored here, let it be)
// No increment or decrement of address after every read/write

lcd_gotoxy(1,1);
lcd_putc("DATA is=");
lcd_gotoxy(1,2);
Lcd_display_byte(1,2,PMP_data);// used a 2*8 LCD for show data which read from data port

delay_ms(2000);

PMADDRH = 0xCf;
PMADDRL = 0x00;

//PMP_data = 0x0F;
//PMDIN1L = PMP_data; // used for write data test

PMP_data = PMDIN1L; // used for read data test

lcd_gotoxy(1,1);
lcd_putc("DATA is=");
lcd_gotoxy(1,2);
Lcd_display_byte(1,2,PMP_data); // used a 2*8 LCD for show data which read from data port

}

Thanks!

Ttelmah

Joined: 11 Mar 2010Posts: 14081

Posted: Mon Dec 18, 2017 2:00 am

Well done.
Unfortunately, the sheer number of modes on some chips, really says that CCS need to 're-think' how the PIC18 function works. It'd be much more friendly to have the function offering separate fields for the mode, output mask etc., and a proper example. Like you I had to go 'DIY' to get it to work properly.
At least you now have it going.