compiler error program sequencer lights

General discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
jose_pic16f887
Posts: 26
Joined: 10 Sep 2018 11:08

compiler error program sequencer lights

#1 Post by jose_pic16f887 » 02 May 2023 15:55

Hi guys, I'm working on a light sequencer with pic 16f628a.
I use the mikro basic compiler for pic.
but when compiling it gives me the following errors
attached image
The comments are in Spanish
I hope you can help me
thank you :(

program Secuenciador
main: 'Este es el cuerpo del programa
'Declaracion de Variables
dim i as byte
dim p as byte
PORTA = 0
adcon1 = 6 'Configuro puerto A como Digital I/O
TRISA = %00001111 'Puerto A0,A1,A2,A3 como entradas, resto salidas
TRISB = %00000000 ' PuertoB todo como salidas
PORTB = %00000000 ' Apago los LEDs conectados al puertoB
while TRUE ' Comienzo un bucle infinito
‘Calculo el numero de programa seleccionado con los switches
P = PORTA.0 + PORTA.1*2 + PORTA.2*4 + PORTA.3*8
if P = 0 then ' Programa “0000”
' Enciendo secuenciamente las luces,
' con una demora de 200 milisegundos entre una y otra
PORTB = %00000001 ' Enciendo el LED 0
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00000010 ' Enciendo el LED 1
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00000100 ' Enciendo el LED 2
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00001000 ' Enciendo el LED 3
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00010000 ' Enciendo el LED 4
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00100000 ' Enciendo el LED 5
delay_ms(200) ' Espero 200 milisegundos
PORTB = %01000000 ' Enciendo el LED 6
delay_ms(200) ' Espero 200 milisegundos
PORTB = %10000000 ' Enciendo el LED 7
delay_ms(200) ' Espero 200 milisegundos
‘Ahora, programo el “regreso” de la luz….
PORTB = %01000000 ' Enciendo el LED 6
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00100000 ' Enciendo el LED 5
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00010000 ' Enciendo el LED 4
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00001000 ' Enciendo el LED 3
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00000100 ' Enciendo el LED 2
delay_ms(200) ' Espero 200 milisegundos
PORTB = %00000010 ' Enciendo el LED 1
delay_ms(200) ' Espero 200 milisegundos
End if
' Aquí irian las demas preguntas para ver si
' el programa seleccionado es otro (hay que comprobar
' desde “0000” a “1111” (de 0 a 15)
if P = 1 then ' Programa “0001”
' Programa 1………
End if
' etc,etc,etc…..
wend ' repetir el bucle.
end. 'Fin del programa
Attachments
compiler error program sequencer lights.jpg
compiler error program sequencer lights.jpg (291.08 KiB) Viewed 681 times

pv31
Posts: 20
Joined: 28 Feb 2015 00:44
Location: Dnep

Re: compiler error program sequencer lights

#2 Post by pv31 » 03 May 2023 06:16

628 does not have an ADC. Choose a processor with ADC. pic16f886 ):

jose_pic16f887
Posts: 26
Joined: 10 Sep 2018 11:08

Re: compiler error program sequencer lights

#3 Post by jose_pic16f887 » 03 May 2023 11:57

thanks for answering
the error was mine when using pic 16f628a, this pic does not have adc, if not analog comparators, I have read the data sheet.
use pic 16f88 and it has adc and the program compiled without errors attached image
And thanks again
:D
Attachments
compile fixed with pic 16f88.jpg
compile fixed with pic 16f88.jpg (328.33 KiB) Viewed 627 times

pv31
Posts: 20
Joined: 28 Feb 2015 00:44
Location: Dnep

Re: compiler error program sequencer lights

#4 Post by pv31 » 03 May 2023 22:42

I hope you enjoy MicroBasic. It has many good libraries for converting variable types.

kkchunghk
Posts: 5
Joined: 16 Jul 2010 03:19

Re: compiler error program sequencer lights

#5 Post by kkchunghk » 03 Nov 2023 04:59

Sorry for borrowing this post as I'm not allowed to compose my first post if I have not tagged on to others (very funny regulation). This is my program and the compiler doesn't recognise ADC_Read(5), why?

KK
Attachments
code.pdf
(196.81 KiB) Downloaded 29 times

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: compiler error program sequencer lights

#6 Post by filip » 03 Nov 2023 11:38

Hi,

Have you ticked ADC library checkbox in the Library Manager ?

Regards,
Filip.

kkchunghk
Posts: 5
Joined: 16 Jul 2010 03:19

Re: compiler error program sequencer lights

#7 Post by kkchunghk » 04 Nov 2023 00:10

That's it. Fundamental mistake. Thank you Filip.

Post Reply

Return to “mikroBasic PRO for PIC General”