According to the first test, it looks like the power supply of the controller is 3.3V and the output is not open drain...
LEDs must be connected through resistors.
PS/2 Keyboard to LCD
-
- Posts: 156
- Joined: 15 Jun 2011 06:37
Re: PS/2 Keyboard to LCD
Sorry, should have mentioned, the LEDs have resistors on the cathode side, in all tests thus far.
So, I added two lines of code;
Again, Both LED's (with resistors) anodes connected to the USB Vcc. One cathode+resistor to RF12, and the other cathode+resistor to RF13.
RF12's LED is permanently ON. While RF13's LED blinks on and completely off.
The code I am using is this;
So, I added two lines of code;
Code: Select all
ODCF13_bit = 1;
ODCF12_bit = 1;
RF12's LED is permanently ON. While RF13's LED blinks on and completely off.
The code I am using is this;
Code: Select all
sbit PS2_Data at RF12_bit;
sbit PS2_Clock at RF13_bit;
sbit PS2_Data_Direction at TRISF12_bit;
sbit PS2_Clock_Direction at TRISF13_bit;
void main() {
CHECON = 0x32; // Cache Control Register (Copied from LCD Library Help files)
AD1PCFG = 0xFFFF; // Configure AN pins as digital I/O
JTAGEN_bit = 0; // Disable JTAG
TROEN_bit = 0; // Disable the Trace Port
TDOEN_bit = 0; // 2-wire JTAG protocol does not use TDO
PMAEN = 0; // This and PMCON 'ON' bit must be cleared so as to make LATE usable.
PMCON = 0; // Disable Parallel Port Contol
TRISA = 0;
TRISB = 0;
TRISC = 0;
TRISD = 0;
TRISE = 0;
TRISF = 0;
TRISG = 0;
LATA = 0;
LATB = 0;
LATC = 0;
LATD = 0;
LATE = 0;
LATF = 0;
LATG = 0;
PS2_Data_Direction = 0;
PS2_Clock_Direction = 0;
PS2_Data = 0;
PS2_Clock = 0;
ODCF12_bit = 1;
ODCF13_bit = 1;
while(1) {
PS2_Data = ~PS2_Data;
PS2_Clock = ~PS2_Clock;
Delay_ms(1000);
}
}
-
- Posts: 135
- Joined: 02 Jan 2020 19:00
Re: PS/2 Keyboard to LCD
Hm. Both should blinks...chris11jed wrote: ↑13 Nov 2022 11:41.............................................
RF12's LED is permanently ON. While RF13's LED blinks on and completely off.
Who knows what's in the mikroe processor definition...
-
- Posts: 156
- Joined: 15 Jun 2011 06:37
Re: PS/2 Keyboard to LCD
I just hope that particular pin isn't screwed
Am not sure what you mean by mikro processor definition. In that, maybe there's still some hope of getting this show back on the road, and fixing the thing.
Am going to sleep on it for now.
Again, much-much appreciating your thoughts and ideas here!
Am not sure what you mean by mikro processor definition. In that, maybe there's still some hope of getting this show back on the road, and fixing the thing.
Am going to sleep on it for now.
Again, much-much appreciating your thoughts and ideas here!
-
- Posts: 135
- Joined: 02 Jan 2020 19:00
Re: PS/2 Keyboard to LCD
\Defs\P32MX695F512L.c
\Defs\P32MX695F512L.mlk
You can also check the frequency settings.
Or rename this file instead of what's in the project.
\Defs\P32MX695F512L.mlk
You can also check the frequency settings.
Or rename this file instead of what's in the project.
- Attachments
-
- PS2.7z
- (318 Bytes) Downloaded 27 times
-
- Posts: 156
- Joined: 15 Jun 2011 06:37
Re: PS/2 Keyboard to LCD
Thanks for the cfg file. I opened it up in Visual Studio to take a look. Also opened up the 'Edit Project' window, where the Configuration Registers are displayed. And have the PIC32MX5XX/6XX/7XX Family Reference Manual Section 00 PDF open to '29.0 Special Features', specifically, the DEVCFG registers.
With the Windows calculator on programmer mode, I can input what the 'Edit Project' window Configuration Registers values are, see the bits, and cross reference with what the Datasheet says.
And there's some stuff that does not match up!!! From reserved stuff the datasheet says should be '1', and mikro says '0'. To selections in the 'General project settings' drop-downs, that don't match up to what the datasheet says the bit or bits should be. And I've only given stuff a cursory glance, not a deep dive.
I am not sure how to go about looking at the \Defs\P32MX695F512L.c and \Defs\P32MX695F512L.mlk files. I opened the \Defs\P32MX695F512L.c file up in Visual Studio... wow! That's a long arse file I am not sure what I am supposed to look for, where, or how to even know if what I'm seeing is 'ok' or 'not'.
And am not sure how to implement your attached .cfg file either? If I select 'Load scheme' in the 'Edit Project' window, it wants .cfgsch
I am actually wondering why my selections in the 'Edit Project' windows 'General project settings' aren't reflected correctly in the 'Configuration Register' DEVCFG3/2/1/0 values? Or, if everything is correct on the 'General project settings' drop-downs, or correct on the 'Configuration Registers' window...
And I don't understand the two values either side of the second ':'. eg; DEVCFG3 : $1FC02FF0 : 0x00070000 The first value, $1FC02FF0, I use to cross reference with the datasheet. But what is the second one, 0x00070000, all about? And how to use it?
Sorry for the lack of understanding. Am an idiot, and appreciate idiot-friendly explanations A lot of this is getting above my pay grade now
Edit:
So, in the \Defs\P32MX695F512L.c file, after scrolling for ages, there is this... which looks okay?
Can't view the \Defs\P32MX695F512L.mlk file though.
Edit 2:
So, I did a little experimenting on a PIC32MX695F512L I have on another PCB, where all the port pins just go to a header, and I then have this PCB on a breadboard.
Tried flashing RF12 and RF13, powered by +5V, with resistors, and the ODCF12_bit & ODCF13_bit both set. Basically, the same code as before.
Again, RF12 is constantly on, while RF13 flashes.
Then I tried RD0 and RD1, with their respective ODC bits set. And Both LEDs flash.
So, that's two different MCU's. I am beginning to think that the pin on the PCB where I have an LCD and other stuff, it isn't screwed. But, something funny is going on with the internals, or settings, or something.
And again, I don't think Mikro's 'Edit Project' window settings are reflective of the Configuration Registers window values. Which might play a part. Note, this is all guess work at the moment.
With the Windows calculator on programmer mode, I can input what the 'Edit Project' window Configuration Registers values are, see the bits, and cross reference with what the Datasheet says.
And there's some stuff that does not match up!!! From reserved stuff the datasheet says should be '1', and mikro says '0'. To selections in the 'General project settings' drop-downs, that don't match up to what the datasheet says the bit or bits should be. And I've only given stuff a cursory glance, not a deep dive.
I am not sure how to go about looking at the \Defs\P32MX695F512L.c and \Defs\P32MX695F512L.mlk files. I opened the \Defs\P32MX695F512L.c file up in Visual Studio... wow! That's a long arse file I am not sure what I am supposed to look for, where, or how to even know if what I'm seeing is 'ok' or 'not'.
And am not sure how to implement your attached .cfg file either? If I select 'Load scheme' in the 'Edit Project' window, it wants .cfgsch
I am actually wondering why my selections in the 'Edit Project' windows 'General project settings' aren't reflected correctly in the 'Configuration Register' DEVCFG3/2/1/0 values? Or, if everything is correct on the 'General project settings' drop-downs, or correct on the 'Configuration Registers' window...
And I don't understand the two values either side of the second ':'. eg; DEVCFG3 : $1FC02FF0 : 0x00070000 The first value, $1FC02FF0, I use to cross reference with the datasheet. But what is the second one, 0x00070000, all about? And how to use it?
Sorry for the lack of understanding. Am an idiot, and appreciate idiot-friendly explanations A lot of this is getting above my pay grade now
Edit:
So, in the \Defs\P32MX695F512L.c file, after scrolling for ages, there is this... which looks okay?
Code: Select all
sfr atomic unsigned long volatile TRISF absolute 0xBF886140;
sfr unsigned long volatile TRISFCLR absolute 0xBF886144;
sfr unsigned long volatile TRISFSET absolute 0xBF886148;
sfr unsigned long volatile TRISFINV absolute 0xBF88614C;
// TRISF bits
const register unsigned short int TRISF13 = 13;
sbit TRISF13_bit at TRISF.B13;
const register unsigned short int TRISF12 = 12;
sbit TRISF12_bit at TRISF.B12;
const register unsigned short int TRISF8 = 8;
sbit TRISF8_bit at TRISF.B8;
const register unsigned short int TRISF5 = 5;
sbit TRISF5_bit at TRISF.B5;
const register unsigned short int TRISF4 = 4;
sbit TRISF4_bit at TRISF.B4;
const register unsigned short int TRISF3 = 3;
sbit TRISF3_bit at TRISF.B3;
const register unsigned short int TRISF2 = 2;
sbit TRISF2_bit at TRISF.B2;
const register unsigned short int TRISF1 = 1;
sbit TRISF1_bit at TRISF.B1;
const register unsigned short int TRISF0 = 0;
sbit TRISF0_bit at TRISF.B0;
sfr atomic unsigned long volatile PORTF absolute 0xBF886150;
sfr unsigned long volatile PORTFCLR absolute 0xBF886154;
sfr unsigned long volatile PORTFSET absolute 0xBF886158;
sfr unsigned long volatile PORTFINV absolute 0xBF88615C;
// PORTF bits
const register unsigned short int RF13 = 13;
sbit RF13_bit at PORTF.B13;
const register unsigned short int RF12 = 12;
sbit RF12_bit at PORTF.B12;
const register unsigned short int RF8 = 8;
sbit RF8_bit at PORTF.B8;
const register unsigned short int RF5 = 5;
sbit RF5_bit at PORTF.B5;
const register unsigned short int RF4 = 4;
sbit RF4_bit at PORTF.B4;
const register unsigned short int RF3 = 3;
sbit RF3_bit at PORTF.B3;
const register unsigned short int RF2 = 2;
sbit RF2_bit at PORTF.B2;
const register unsigned short int RF1 = 1;
sbit RF1_bit at PORTF.B1;
const register unsigned short int RF0 = 0;
sbit RF0_bit at PORTF.B0;
sfr atomic unsigned long volatile LATF absolute 0xBF886160;
sfr unsigned long volatile LATFCLR absolute 0xBF886164;
sfr unsigned long volatile LATFSET absolute 0xBF886168;
sfr unsigned long volatile LATFINV absolute 0xBF88616C;
// LATF bits
const register unsigned short int LATF13 = 13;
sbit LATF13_bit at LATF.B13;
const register unsigned short int LATF12 = 12;
sbit LATF12_bit at LATF.B12;
const register unsigned short int LATF8 = 8;
sbit LATF8_bit at LATF.B8;
const register unsigned short int LATF5 = 5;
sbit LATF5_bit at LATF.B5;
const register unsigned short int LATF4 = 4;
sbit LATF4_bit at LATF.B4;
const register unsigned short int LATF3 = 3;
sbit LATF3_bit at LATF.B3;
const register unsigned short int LATF2 = 2;
sbit LATF2_bit at LATF.B2;
const register unsigned short int LATF1 = 1;
sbit LATF1_bit at LATF.B1;
const register unsigned short int LATF0 = 0;
sbit LATF0_bit at LATF.B0;
sfr atomic unsigned long volatile ODCF absolute 0xBF886170;
sfr unsigned long volatile ODCFCLR absolute 0xBF886174;
sfr unsigned long volatile ODCFSET absolute 0xBF886178;
sfr unsigned long volatile ODCFINV absolute 0xBF88617C;
// ODCF bits
const register unsigned short int ODCF13 = 13;
sbit ODCF13_bit at ODCF.B13;
const register unsigned short int ODCF12 = 12;
sbit ODCF12_bit at ODCF.B12;
const register unsigned short int ODCF8 = 8;
sbit ODCF8_bit at ODCF.B8;
const register unsigned short int ODCF5 = 5;
sbit ODCF5_bit at ODCF.B5;
const register unsigned short int ODCF4 = 4;
sbit ODCF4_bit at ODCF.B4;
const register unsigned short int ODCF3 = 3;
sbit ODCF3_bit at ODCF.B3;
const register unsigned short int ODCF2 = 2;
sbit ODCF2_bit at ODCF.B2;
const register unsigned short int ODCF1 = 1;
sbit ODCF1_bit at ODCF.B1;
const register unsigned short int ODCF0 = 0;
sbit ODCF0_bit at ODCF.B0;
Edit 2:
So, I did a little experimenting on a PIC32MX695F512L I have on another PCB, where all the port pins just go to a header, and I then have this PCB on a breadboard.
Tried flashing RF12 and RF13, powered by +5V, with resistors, and the ODCF12_bit & ODCF13_bit both set. Basically, the same code as before.
Again, RF12 is constantly on, while RF13 flashes.
Then I tried RD0 and RD1, with their respective ODC bits set. And Both LEDs flash.
So, that's two different MCU's. I am beginning to think that the pin on the PCB where I have an LCD and other stuff, it isn't screwed. But, something funny is going on with the internals, or settings, or something.
And again, I don't think Mikro's 'Edit Project' window settings are reflective of the Configuration Registers window values. Which might play a part. Note, this is all guess work at the moment.
-
- Posts: 135
- Joined: 02 Jan 2020 19:00
Re: PS/2 Keyboard to LCD
Let's sequentially, first LED Blink
while(1) {
PS2_Data = 1;
PS2_Clock = 1;
Delay_ms(1000);
PS2_Data = 0;
PS2_Clock = 0;
Delay_ms(1000);
}
or
while(1) {
LATF12_bit = ~PS2_Data;
LATF13_bit = ~PS2_Clock;
Delay_ms(1000);
}
At least one option works?
And I did not work with PIC32. Mostly with ARM.
while(1) {
PS2_Data = 1;
PS2_Clock = 1;
Delay_ms(1000);
PS2_Data = 0;
PS2_Clock = 0;
Delay_ms(1000);
}
or
while(1) {
LATF12_bit = ~PS2_Data;
LATF13_bit = ~PS2_Clock;
Delay_ms(1000);
}
At least one option works?
And I did not work with PIC32. Mostly with ARM.
-
- Posts: 156
- Joined: 15 Jun 2011 06:37
Re: PS/2 Keyboard to LCD
Test one;
Result: PS2_Data (RF12) LED is constantly on. PS2_Clock (RF13) is blinking.
Test Two;
Result: PS2_Data (RF12) LED is constantly on. PS2_Clock (RF13) is blinking. Same as Test One.
Code: Select all
sbit PS2_Data at RF12_bit;
sbit PS2_Clock at RF13_bit;
sbit PS2_Data_Direction at TRISF12_bit;
sbit PS2_Clock_Direction at TRISF13_bit;
void main() {
CHECON = 0x32; // Cache Control Register (Copied from LCD Library Help files)
AD1PCFG = 0xFFFF; // Configure AN pins as digital I/O
JTAGEN_bit = 0; // Disable JTAG
TROEN_bit = 0; // Disable the Trace Port
TDOEN_bit = 0; // 2-wire JTAG protocol does not use TDO
PMAEN = 0; // This and PMCON 'ON' bit must be cleared so as to make LATE usable.
PMCON = 0; // Disable Parallel Port Contol
TRISA = 0;
TRISB = 0;
TRISC = 0;
TRISD = 0;
TRISE = 0;
TRISF = 0;
TRISG = 0;
LATA = 0;
LATB = 0;
LATC = 0;
LATD = 0;
LATE = 0;
LATF = 0;
LATG = 0;
ODCF12_bit = 1;
ODCF13_bit = 1;
while(1) {
PS2_Data = 1;
PS2_Clock = 1;
Delay_ms(1000);
PS2_Data = 0;
PS2_Clock = 0;
Delay_ms(1000);
}
}
Test Two;
Code: Select all
sbit PS2_Data at RF12_bit;
sbit PS2_Clock at RF13_bit;
sbit PS2_Data_Direction at TRISF12_bit;
sbit PS2_Clock_Direction at TRISF13_bit;
void main() {
CHECON = 0x32; // Cache Control Register (Copied from LCD Library Help files)
AD1PCFG = 0xFFFF; // Configure AN pins as digital I/O
JTAGEN_bit = 0; // Disable JTAG
TROEN_bit = 0; // Disable the Trace Port
TDOEN_bit = 0; // 2-wire JTAG protocol does not use TDO
PMAEN = 0; // This and PMCON 'ON' bit must be cleared so as to make LATE usable.
PMCON = 0; // Disable Parallel Port Contol
TRISA = 0;
TRISB = 0;
TRISC = 0;
TRISD = 0;
TRISE = 0;
TRISF = 0;
TRISG = 0;
LATA = 0;
LATB = 0;
LATC = 0;
LATD = 0;
LATE = 0;
LATF = 0;
LATG = 0;
ODCF12_bit = 1;
ODCF13_bit = 1;
while(1) {
PS2_Data = ~PS2_Data;
PS2_Clock = ~PS2_Clock;
Delay_ms(1000);
}
}
-
- Posts: 135
- Joined: 02 Jan 2020 19:00
Re: PS/2 Keyboard to LCD
The answer is obvious. Deal with RF12 or switch to another pin.
-
- Posts: 156
- Joined: 15 Jun 2011 06:37
Re: PS/2 Keyboard to LCD
Well, that's why I'm here. Trying to deal with RF12 now.The answer is obvious. Deal with RF12 or switch to another pin.
I might just have to switch to another pin.
Thanks for your input though. Much appreciated.