Hello!
I have tested the MikroC 7.3.0 Beta version and it seems to me that my problem with PIC18F47K42 is still the same as before with the 7.2.0 version.
I have my code down below which i used as an example code.
I have less knowledge about PIC18F47K42 and as what I have observed the MCU is fluctuating or rebooting every second. The GLCD
flickers and the program will restart. I monitored with a PicoScope and the output pins are fluctuating to zero then back to normal.
I am using EasyPicV7 HW Rev. 1.03.
The program is working fine when i used a PIC16F887 and with the sample code a little bit modified to run the MCU. There were no fluctuations.
Can somebody please tell me if it is a hardware issue or a coding issue? Does anybody tried the beta version and found to be working perfectly now?
I can not point where to start trouble shooting.
Thanks!
const code char truck_bmp[1024] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 64, 64, 64, 64, 64, 64, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 160, 160, 160, 96, 224, 224, 96, 96, 96, 32, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 0, 0, 64, 64, 64, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 254, 0, 1, 1, 1, 1, 1, 253, 253, 253, 253, 1, 1, 1, 1, 1, 1, 253, 253, 253, 253, 1, 1, 1, 1, 253, 253, 253, 253, 249, 241, 225, 193, 129, 193, 225, 249, 253, 253, 253, 253, 253, 1, 1, 1, 1, 253, 253, 253, 253, 221, 221, 221, 29, 17, 1, 255, 1, 1, 1, 1, 0, 254, 1, 168, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 224, 24, 36, 132, 0, 2, 130, 5, 81, 68, 112, 160, 192, 96, 96, 32, 0, 128, 128, 192, 192, 192, 64, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 63, 96, 96, 96, 224, 96, 96, 127, 127, 127, 127, 124, 124, 124, 124, 96, 96, 127, 127, 127, 127, 96, 96, 96, 96, 127, 127, 127, 127, 97, 103, 111, 127, 127, 111, 103, 99, 97, 127, 127, 127, 127, 96, 96, 96, 96, 127, 127, 127, 127, 125, 125, 125, 124, 116, 96, 127, 64, 64, 64, 160, 96, 252, 246, 1, 14, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 66, 114, 60, 32, 16, 16, 0, 4, 2, 3, 2, 0, 0, 0, 4, 4, 4, 4, 20, 16, 16, 16, 16, 16, 9, 9, 41, 112, 32, 67, 5, 240, 126, 174, 128, 56, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 127, 127, 127, 127, 255, 255, 247, 251, 123, 191, 95, 93, 125, 189, 189, 63, 93, 89, 177, 115, 243, 229, 207, 27, 63, 119, 255, 207, 191, 255, 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127, 255, 255, 255, 127, 127, 125, 120, 120, 120, 120, 120, 248, 120, 120, 120, 120, 120, 120, 248, 248, 224, 135, 0, 0, 0, 0, 0, 0, 0, 0, 128, 240, 248, 120, 188, 220, 92, 252, 28, 28, 60, 92, 92, 60, 120, 248, 248, 96, 192, 143, 168, 216, 136, 49, 68, 72, 2, 160, 96, 0, 0, 0, 0, 0, 0,
0, 0, 0, 128, 192, 248, 248, 248, 248, 252, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 246, 239, 208, 246, 174, 173, 169, 128, 209, 208, 224, 247, 249, 255, 255, 252, 220, 240, 127, 255, 223, 255, 255, 255, 255, 255, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 254, 255, 190, 255, 255, 253, 240, 239, 221, 223, 254, 168, 136, 170, 196, 208, 228, 230, 248, 127, 126, 156, 216, 224, 240, 240, 242, 242, 240, 177, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 3, 3, 3, 7, 7, 7, 7, 7, 15, 15, 15, 7, 15, 15, 15, 7, 7, 15, 14, 15, 13, 15, 47, 43, 43, 43, 43, 43, 47, 111, 239, 255, 253, 253, 255, 254, 255, 255, 255, 255, 255, 191, 191, 239, 239, 239, 191, 255, 191, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 255, 255, 191, 191, 191, 191, 255, 254, 255, 253, 255, 255, 255, 251, 255, 255, 255, 127, 125, 63, 31, 31, 31, 31, 31, 31, 63, 15, 15, 7, 7, 3, 3, 3, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 11, 11, 11, 11, 7, 3, 14, 6, 6, 6, 2, 18, 19, 19, 3, 23, 21, 21, 17, 1, 19, 19, 3, 6, 6, 14, 15, 15, 7, 15, 15, 15, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
// Glcd module connections
char GLCD_DataPort at PORTD;
sbit GLCD_CS1 at RB0_bit;
sbit GLCD_CS2 at RB1_bit;
sbit GLCD_RS at RB2_bit;
sbit GLCD_RW at RB3_bit;
sbit GLCD_EN at RB4_bit;
sbit GLCD_RST at RB5_bit;
sbit GLCD_CS1_Direction at TRISB0_bit;
sbit GLCD_CS2_Direction at TRISB1_bit;
sbit GLCD_RS_Direction at TRISB2_bit;
sbit GLCD_RW_Direction at TRISB3_bit;
sbit GLCD_EN_Direction at TRISB4_bit;
sbit GLCD_RST_Direction at TRISB5_bit;
// End Glcd module connections
void delay2S()
{ // 2 seconds delay function
Delay_ms(2000);
}
void main()
{
unsigned short ii;
char *someText;
#define COMPLETE_EXAMPLE // comment this line to make simpler/smaller example
ANSELA = 0; // Configure AN pins as digital
ANSELB = 0;
ANSELC = 0;
ANSELD = 0;
ANSELE = 0;
CMP2MD_bit = 0; // Disable comparators
CMP1MD_bit = 0;
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00); // Clear GLCD
while(1)
{
#ifdef COMPLETE_EXAMPLE
Glcd_Image(truck_bmp); // Draw image
delay2S();
delay2S();
#endif
Glcd_Fill(0x00); // Clear GLCD
Glcd_Box(62,40,124,56,1); // Draw box
Glcd_Rectangle(5,5,84,35,1); // Draw rectangle
Glcd_Line(0, 0, 127, 63, 1); // Draw line
delay2S();
for(ii = 5; ii < 60; ii+=5 )
{ // Draw horizontal and vertical lines
Delay_ms(250);
Glcd_V_Line(2, 54, ii, 1);
Glcd_H_Line(2, 120, ii, 1);
}
delay2S();
Glcd_Fill(0x00); // Clear GLCD
#ifdef COMPLETE_EXAMPLE
Glcd_Set_Font(Font_Glcd_Character8x7, 8, 7, 32); // Choose font, see __Lib_GLCDFonts.c in Uses folder
#endif
Glcd_Write_Text("mikroE", 1, 7, 2); // Write string
for (ii = 1; ii <= 10; ii++) // Draw circles
Glcd_Circle(63,32, 3*ii, 1);
delay2S();
Glcd_Box(12,20, 70,57, 2); // Draw box
delay2S();
#ifdef COMPLETE_EXAMPLE
Glcd_Fill(0xFF); // Fill GLCD
Glcd_Set_Font(Font_Glcd_Character8x7, 8, 7, 32); // Change font
someText = "8x7 Font";
Glcd_Write_Text(someText, 5, 0, 2); // Write string
delay2S();
Glcd_Set_Font(Font_Glcd_System3x5, 3, 5, 32); // Change font
someText = "3X5 CAPITALS ONLY";
Glcd_Write_Text(someText, 60, 2, 2); // Write string
delay2S();
Glcd_Set_Font(Font_Glcd_System5x7, 5, 7, 32); // Change font
someText = "5x7 Font";
Glcd_Write_Text(someText, 5, 4, 2); // Write string
delay2S();
Glcd_Set_Font(Font_Glcd_5x7, 5, 7, 32); // Change font
someText = "5x7 Font (v2)";
Glcd_Write_Text(someText, 50, 6, 2); // Write string
delay2S();
#endif
}
}
MikroC 7.3.0 Beta
Re: MikroC 7.3.0 Beta
Hi,
There's special forum for discussing beta versions: mikroC PRO for PIC Beta Testing.
As for your code, starting with the usual suspects - did you switch off the watchdog in Edit Project (it's on by default)?
There's special forum for discussing beta versions: mikroC PRO for PIC Beta Testing.
Wouldn't use the word 'perfectly' , but the main obstacles have been removed (partly by brute force, i.e. separate libraries for K42 and K83 processors). I have successfully run a GLCD project, though based on my own GLCD library.genesis614 wrote:Does anybody tried the beta version and found to be working perfectly now?
As for your code, starting with the usual suspects - did you switch off the watchdog in Edit Project (it's on by default)?
-
- Posts: 5
- Joined: 28 Dec 2018 17:04
Re: MikroC 7.3.0 Beta
Thanks Janni!
I did not know the WDT is ON by default.
That is why it keeps on resetting. It is working now.
I also have to check my Oscillator because it is running slow.
I have a 16Mhz Crystal connected to my MCU but the the output is slow.
It is like i have set a 1 second delay but the actual delay is more than 4 seconds.
I have a snap shot below of the MCU General Config Settings.
I did not know the WDT is ON by default.
That is why it keeps on resetting. It is working now.
I also have to check my Oscillator because it is running slow.
I have a 16Mhz Crystal connected to my MCU but the the output is slow.
It is like i have set a 1 second delay but the actual delay is more than 4 seconds.
I have a snap shot below of the MCU General Config Settings.
- Attachments
-
- MikroC.PNG (235.17 KiB) Viewed 3928 times
Re: MikroC 7.3.0 Beta
Well, it depends on what mE developers decide to do in definition files. Apparently nobody had time to prepare safe settings.genesis614 wrote:I did not know the WDT is ON by default.
You should also clear the Multi-Vector interrupt enable bit - at the moment it seems to have no effect on compiler but it will have effect on processor if you try to use interrupts.
That's possible - you have the Fail-Safe Clock Monitor enabled, which means that processor may operate on default 4MHz internal clock.I also have to check my Oscillator because it is running slow.
I have a 16Mhz Crystal connected to my MCU but the the output is slow.
It is like i have set a 1 second delay but the actual delay is more than 4 seconds.