Too many instructions
Too many instructions
I've been trying to do a osciloscope with pic 18f4550 and a GLCD module.
i've managed to get pretty far, but i'm having problems with what seems to be too many instructions.
Isolated all my instructions work pretty fine, but when i add some or all of them togheter it simply does not work.
anyone has any idea of what could be happening?
i've managed to get pretty far, but i'm having problems with what seems to be too many instructions.
Isolated all my instructions work pretty fine, but when i add some or all of them togheter it simply does not work.
anyone has any idea of what could be happening?
Re: Too many instructions
Please post the complete code so that the cause for the problem can be found.
[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: Too many instructions
Hello,
Please see these projects:
Oscilloscope with lcd 128x64
http://www.libstock.com/projects/view/5 ... lcd-128x64
Digital Oscilloscope with lcd 240x128
http://www.libstock.com/projects/view/5 ... cd-240x128
Best regards,
Peter
Please see these projects:
Oscilloscope with lcd 128x64
http://www.libstock.com/projects/view/5 ... lcd-128x64
Digital Oscilloscope with lcd 240x128
http://www.libstock.com/projects/view/5 ... cd-240x128
Best regards,
Peter
Re: Too many instructions
My code:
Code: Select all
char GLCD_DataPort at PORTD;
sbit GLCD_CS1 at RB5_bit;
sbit GLCD_CS2 at RB7_bit;
sbit GLCD_RS at RB2_bit;
sbit GLCD_RW at RB3_bit;
sbit GLCD_EN at RB4_bit;
sbit GLCD_RST at RB6_bit;
sbit GLCD_CS1_Direction at TRISB5_bit;
sbit GLCD_CS2_Direction at TRISB7_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 TRISB6_bit;
/*
sbit LCD_RS at RE2_bit;
sbit LCD_EN at RE1_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISE2_bit;
sbit LCD_EN_Direction at TRISE1_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
*/
#define botao portb.RB0
void linhas()
{
//Glcd_fill(0);
Glcd_v_line(0,49,0,1);
Glcd_v_line(0,49,127,1);
Glcd_h_line(0,127,0,1);
Glcd_h_line(0,127,50,1);
}
void main()
{
float dado[128];
int var;
int vbr;
int vcr;
int v;
int x;
int y;
int z;
int tempo;
unsigned char texto[20];
unsigned char amp[20];
unsigned char periodo[20];
TRISB=0b00000001; //Configura a direção do PORTB
adcon0=0b00000001;
adcon1=0b00001110;
adcon2=0b00000110; //Configura AD
delay_ms(2000); //Tempo de start-up do display
tempo=10;
Glcd_init();
while (tempo!=0) //loop infinito
{
//Glcd_fill(0);
if (!botao)
tempo=tempo * 10; //Botão está pressionado?
if(tempo>1000)
tempo=10;
var=0; //reinicializa contadores
x=0;
y=0;
vcr=0;
while(var<127){ //atrasa valores no vetor
adcon0.go_done=1; //Inicializa a conversão
while(adcon0.go_done); //Aguarda finalizar a conversão
dado[var]=((adresh)); //Lê o conteúdo da conversão
dado[var]= dado[var] * 0.1953125; //conversão para o valor da voltagem considerando espaço de 5 volts em 256 amostras
if((int)dado[var]>y) //y usado para gravar o valor de amplitude máxima
y=(int)(dado[var]);
++var;
vdelay_ms(tempo);
}
vbr=0; //reinicialização de contador
Glcd_fill(0); //limpa a tela para iniciar gráfico
while(vbr<127){ //loop de impressão
x=(int)(dado[vbr]); //imprimir valores *10 para que cada ponto equivala a 0,1Volt
Glcd_dot(vbr,x,2);
x=0;
++vbr;
}
while (vcr<100){
v=vcr+1;
x=vcr+2;
if (dado[vcr]==dado[1] && dado[v]==dado[2] && 1==1)
z=v;
//if (dado[vcr]==dado[2])
// v=v+1;
// if(dado[v]==dado[3]){
// z=vcr;}
//}
++vcr;
}
inttostr(z,periodo); //conversão para saber período
ltrim(periodo); //limpeza do string
glcd_write_text(periodo,20,7,2); //impressão do periodo em segs
inttostr(y,amp); //conversão para saber a amplitude máxima
ltrim(amp); //limpeza so string
glcd_write_text(amp,1,7,2); //impressão amplitude máxima
inttostr(tempo,texto); //conversão do sampling rate
ltrim(texto); //limpeza do string
glcd_write_text(texto,40,7,2); //impressão do sampling rate
linhas(); //impressão da grade na tela
//delay_ms(3000); //Aguarda 3000 ms
}
}
Re: Too many instructions
While(1) loop is missing.
[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
Re: Too many instructions
tempo is always !=0.
i had it as while(1) before, same problem.
i had it as while(1) before, same problem.
Re: Too many instructions
Zip and post the complete mikroC project files.
[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: Too many instructions
Hello,
Please Zip and attach in new post latest version of project files.
Best regards,
Peter
Please Zip and attach in new post latest version of project files.
Best regards,
Peter
Re: Too many instructions
@carltonb
The code compiled successfully for me. I didn't check your ADCONx settings. ADC result is 10-bit and you have to replace
by
Zip and post the code which gives "too many initializers" error.
You get that "too many initializers" error if you try something like this.
The code compiled successfully for me. I didn't check your ADCONx settings. ADC result is 10-bit and you have to replace
Code: Select all
dado[var]=((adresh));
Code: Select all
dado[var]=(adresh << 8) | adresl; // if ADC result is right justified.
You get that "too many initializers" error if you try something like this.
Code: Select all
unsigned char test[4] = "Hello"; //Hello + '\0' = 6 characters, doesn't fit in 4 bytes
[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
Re: Too many instructions
Its not an error of "too many identifiers".
Its not a compiling error at all, its just an error at the device itself.
The instructions are only played "half-way" or not at all depending on how many instructions i add to the program.
i have a few pic18f4550 and tested if it was a chip problem but it is not.
Its not a compiling error at all, its just an error at the device itself.
The instructions are only played "half-way" or not at all depending on how many instructions i add to the program.
i have a few pic18f4550 and tested if it was a chip problem but it is not.
Re: Too many instructions
whenever i get this problem, i noticed that in the hex only has on position 0000 D7FF.
everything else is FFFF.
everything else is FFFF.
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: Too many instructions
Hello,
What version of compiler you have?
Compiler have proper license?
Try HEX file from attachment.
Best regards,
Peter
What version of compiler you have?
Compiler have proper license?
Try HEX file from attachment.
Best regards,
Peter
- Attachments
-
- MyProject.zip
- Only HEX file.
- (5.5 KiB) Downloaded 149 times
Re: Too many instructions
1. 80% you have the license problem ! if you are not registered, register it properly.
2. why you didn't use my oscop project ? petar.timotijevic has told you ! you can see a lot !
3. you better not to use all library's together. its not cool ! think first, then read manual if needed, then choose.
4. you cant use dot for showing on glcd. i had this problem too. its better if you use line instead of dot.
5. i put your code in Proteus with a little changes. check it out and see it is working ! but not very cool ! it needs work.
good luck .
best regards, Josef.
2. why you didn't use my oscop project ? petar.timotijevic has told you ! you can see a lot !
3. you better not to use all library's together. its not cool ! think first, then read manual if needed, then choose.
4. you cant use dot for showing on glcd. i had this problem too. its better if you use line instead of dot.
5. i put your code in Proteus with a little changes. check it out and see it is working ! but not very cool ! it needs work.
good luck .
best regards, Josef.
- Attachments
-
- microc3.rar
- (86.03 KiB) Downloaded 162 times