PPS pin-peripheral assignments??

General discussion on mikroPascal PRO for PIC.
Author
Message
janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: PPS pin-peripheral assignments??

#31 Post by janni » 16 Feb 2013 15:15

Looks really nice :D . What is this project?

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: PPS pin-peripheral assignments??

#32 Post by Rotary_Ed » 16 Feb 2013 15:56

Hi janni,

The product is called an Electronic Ignition Commander (EIC) - it monitors and controls two electronic ignition systems aboard Homebuilt aircraft. I have sold them for over 5 years around the world and it is now stocked by a world wide Aircraft supply house.

However, in an attempt to stay up with the real world, I am going to this new 18F67J94 chips because it has 4 UART modules. My current system (uses a 18F6722 chip) requires two UART (one to communicate with each of the electronic ignitions) and I wanted additiona UART ports to talk to Bluetooth and EEPROM chips. The 18F67J94 fills the bill nicely as it has 4 Uart modules and a USB module - however, as you are well aware, it is not yet support by the MKP.

My intention is to use this module to process the ignition data and then using the bluetooth or USB to communicate with an Android based Smartphone/Table for display and control - possiblity without cable (if the bluetooth works out). The Smartphone gives more freedom with graphic and displays design than my current 1.5" OLED module. I have a basic Android program/app started, but could go no further until I get this modules bluetooth transceiver intergrated and working and that in turn requires me to be able to assign the Peripherial modules to pin, which in turn required me to get the Definitiion and MCL files developed, which -- required your able assistance. :)

So that's where it stands now, still selling the current version, but would like to get the new smartphone version up and running within the next month or so. The problem is I am undoubtedly more difficient in Andriod than Pascal - which does not bode well - but, am stubborn and persistent, so perhaps will prevail :lol:

There! undoubtedly told you more than you wanted to know :D

I truly value and appreciate your help

Attached shows one of the 4 primary operational screens (called the TDA (Timing Divergence Alarm) display). What this is showing is there is 3 deg of divergence (2 is normal) between the firing point of the two independent ignitions. IF the divergence hits 6 deg an alarm triggers. The two boxes show the timing advance for each ignitioin (left and right) and the blue/white bars to the right shows the "health" of the coil packs/ignition wires and sparkplugs - in the greenbox is nominal. There are other screens with RPM and Manifold pressure and temperatures, etc as well as a bunch of configuration setting diplays.

TDA Display
TDA Display
EIC 8 Firing DSC00179.jpg (70.9 KiB) Viewed 3550 times
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: PPS pin-peripheral assignments??

#33 Post by janni » 16 Feb 2013 19:59

That's pretty advanced application :D . And though the graphical interface is perfectly realized on this tiny screen, I well understand the drive to make even better user interface :wink: .

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: PPS pin-peripheral assignments??

#34 Post by Rotary_Ed » 17 Feb 2013 00:45

Thanks, janni

Yes, the use of the OLED type display has the resolution, contrast and viewing angle that makes it pretty well suited to cockpit usage. If it only had a bit higher "nit" rating then it would be perfect.

I just sometimes think I bite off more than I can chew - but, no pain - no gain as they say :mrgreen:
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

pk7639
Posts: 24
Joined: 24 Jun 2011 05:07

Re: PPS pin-peripheral assignments??

#35 Post by pk7639 » 25 Sep 2013 09:30

Impressive work! There's a great Calvin Coolidge quote. http://www.quotationspage.com/quote/2771.html very applicable here.

So I'm now looking to migrate our products to this chip.. 4 UARTS and a built in RTCC with battery backup! Wooo hoo.
I have a definition file from the MikroElectronica guys. No doubt significantly thanks to you... and I'm programming with PICKit3 (the latest MPLAB download supports it). Mikroprog support for this device seems to be a work in progress.

I have my LED flashing so, bursting with confidence, I'm trying to get a UART to spit some chars out..

I wonder if you could help remove a variable or two from my problem.

I'm listening for serial data on pin 4 (RP39) and my C code looks like this:
void main() {
TRISC.B3=0;

ANCON1=0;
ANCON2=0;
ANCON3=0;

OSCCON.B6=0;
RPINR2_3=0x0B;
RPOR38_39=0x20;
OSCCON.B6=1;
BAUDCON2.BRG16=0;
RCSTA2=0b00100100;
TXSTA2=0b10010000;
SPBRG2=21;

while(1)
{
LATC.B3=1;
Delay_ms(500);
LATC.B3=0;
Delay_ms(500);
TXREG2='@';
}
}

Do my PPS-Lite Pin assignments look OK?

Many thanks.

Paul Kelly

pk7639
Posts: 24
Joined: 24 Jun 2011 05:07

Re: PPS pin-peripheral assignments??

#36 Post by pk7639 » 25 Sep 2013 10:30

Inching forward.. Gotta turn off the LCD driver, and IOLOCK is in OSCCON2 not OSCCON1 (the datasheet has a typo in section 11.15.5.1)

I'm now at:

void main() {
TRISC.B3=0;

ANCON1=0;
ANCON2=0;
ANCON3=0;

LCDCON=0;
LCDSE0=0;
LCDSE1=0;
LCDSE2=0;
LCDSE3=0;
LCDSE4=0;
LCDSE5=0;
LCDSE6=0;
LCDSE7=0;
LCDREG=0;

RPINR2_3=0x0B;
RPOR38_39=0x20;
OSCCON2.B6=1;

BAUDCON2.BRG16=0;
RCSTA2=0b00100100;
TXSTA2=0b10010000;
SPBRG2=21;
TRISG.B1=0;

while(1)
{
LATC.B3=1;
Delay_ms(500);
LATC.B3=0;
Delay_ms(500);
TXREG2='@';
}
}


And the output is at least digital. No serial data though...
PK

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: PPS pin-peripheral assignments??

#37 Post by Rotary_Ed » 25 Sep 2013 13:34

Thanks, pk7639

I abandon the PIC18F97J94 chip when I realized that I needed more Flash memory. I have since migrated to a PIC32 chip.

However, I am attaching a tool (sort of), I wrote in Pascal to input the Peripherial module and pin and have it generate the correct code. As far as I tested it, it worked. There are a number of examples including, but you do have to go into debug mode to run it and watch the PPS registers in the WATCH window. Don't know if it will be useful to you are not, but you are welcome to it.

As far as the code you showed, I believe (its been a while) that I see an error in your PPS assignment.

Code: Select all

//Serial Data in on pin 4 (RP39)
//Looking at table 11-13 of PIC18F97J94 the (group 4n +3)  shows
// that to  assign U2TX   to pin 4
//(RP39), you would need to insert h'9 (1001) into positions <7:4> (RPINR2_3<7:4> = RPINR2_3 = 0x9F ) to //assign the U2TX function to pin4 (RP39)
//Note:  All input fields are initialized to all "1"s (Para 11.15.3.1) - so any part of the registery that you are not
//assigning to a pin needs to remain "1"s.  That is why I show RPINR2_3 = 0x9F rather than just 0x90)


RPINR2_3=0x0B;  //****Looks like to me that this needs to be RPINR2_3 = 0x9F;  I see no valid assignment of 'hB to any pin other than RP46

RPOR38_39=0x20;//With this assignment (RPOR38_39<3:0> = 0x20), you are assigning pin RP38 to output //signal U2RX_DT
Good luck!
Attachments
PPS1 21 May 2013 W5.zip
PPS Assignment Tool
(141.73 KiB) Downloaded 182 times
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

pk7639
Posts: 24
Joined: 24 Jun 2011 05:07

Re: PPS pin-peripheral assignments??

#38 Post by pk7639 » 26 Sep 2013 04:36

Thanks heaps for the response, I'll check the RP46 issue and try out your tool.

I do now have RP39 mapped to the EUSART and sending data. Yay!
The last piece of the puzzle was figuring out I had set TXSTA2 wrong....Doh!
Making progress now..
PK

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: PPS pin-peripheral assignments??

#39 Post by Rotary_Ed » 26 Sep 2013 13:06

Sounds like progress. Yes, your output pin assignment looked to be correct for output RPOR38-39 which is likely why you are getting output. But, I do not believe your input pin assignment is correct.

PPS Input groups 4n+2 and 4n+3 are the only two places you will find the register RPIN2_3. Of these two, only 4n+3 allows the assignment of pin 4 RP39 to that register by assigning h'9 to the high nibble of the register or RPIN2_3 := 0x9F. As I mentioned the data sheet indicates that all unused PPS input register nibbles should be set to "1" as default.

That is why in my "tool" the first thing I do is assign $FF to all input registers and $00 to all output registers.

Continue effort = Progress (most of the time) :)
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Post Reply

Return to “mikroPascal PRO for PIC General”