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
compiler error program sequencer lights
-
- Posts: 26
- Joined: 10 Sep 2018 11:08
compiler error program sequencer lights
- Attachments
-
- compiler error program sequencer lights.jpg (291.08 KiB) Viewed 849 times
Re: compiler error program sequencer lights
628 does not have an ADC. Choose a processor with ADC. pic16f886 ):
-
- Posts: 26
- Joined: 10 Sep 2018 11:08
Re: compiler error program sequencer lights
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
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
- Attachments
-
- compile fixed with pic 16f88.jpg (328.33 KiB) Viewed 795 times
Re: compiler error program sequencer lights
I hope you enjoy MicroBasic. It has many good libraries for converting variable types.
Re: compiler error program sequencer lights
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
KK
- Attachments
-
- code.pdf
- (196.81 KiB) Downloaded 40 times
Re: compiler error program sequencer lights
Hi,
Have you ticked ADC library checkbox in the Library Manager ?
Regards,
Filip.
Have you ticked ADC library checkbox in the Library Manager ?
Regards,
Filip.
Re: compiler error program sequencer lights
That's it. Fundamental mistake. Thank you Filip.