⚡ Descuentos en cursos en video - Lleva tu aprendizaje técnico al siguiente nivel y aprovecha precios especiales antes de que termine la oferta. 🔥 Aprovechar oferta ahora 🔥
Microcontrollers and digital systems

Microcode Programming

junior259
junior259
103
hace 5 años
hace 5 años
Good evening, electronic friends, I am trying to carry out basic projects in PIC, and now I want to program a PIC where I can handle three outputs with three buttons, each independent of the other. I can configure only one, with which I will control the switching on and off of a lamp by means of a relay. But I can not configure the other two, and I assume that it is a problem of the programming that I am doing, the only thing I want and I need is to control the other two outputs with each button independently, one of them timed to 10 sec. and the other timed to 5 sec. Cont var bit CONT = 0 start: IF pul1 = 0 THEN while pul1 = 0 wend cont = cont + 1 if cont> 1 then cont = 0 endif endif select case cont case 0 low lamp case 1 High lamp end select goto start end This is for the control of a relay on and off, as I can include the timed control of the other two. Thanks for your help...!!!
junior259
junior259
103
hace 5 años

I used "pul1" and "lamp" as variables for ports B0 and B1 ... (so that it is better understood)

Responder
sergiouasd
sergiouasd
3.527
hace 5 años
hace 5 años
Regards . I suggest applying something like this: ; first define the pins that will be activated ; in each case let's say lamp1, lamp2, lamp3. ; using port b0, b1, b2. lamp1 var portb.0 lamp2 var porb.1 lamp3 var portb.2 ; I assign the names to the pins they will handle ; the pul1, pul2 and pul3 buttons. ; We use the same port b for ease. pul1 var portb.3 pul2 var portb.4 pul3 var portb.5 ; creating a time variable t var byte ; We do the routine. lamps: if pul1 = 0 then for t = 0 to 9 pause 1000 ; pause 1s x 10 repetitions = 10 s next high lamp1 endif ; for lamp 2 if pul2 = 0 then for t = 0 to 9 pause 1000 ; pause 1s x 10 repetitions = 10 s next high lamp2 endif ; for lamp 3 if pul1 = 3 then for t = 0 to 9 pause 1000 ; pause 1s x 10 repetitions = 10 s next high lamp3 endif end
junior259
junior259
103
hace 5 años

thanks friend for the help ... a favor, I don't know if you can guide me in some projects or sometimes problems that I have in programming ... thanks a lot ... !!!

Responder
sergiouasd
sergiouasd
3.527
hace 5 años

clear as far as you can

Responder
junior259
junior259
103
hace 5 años

My dear, I have a project with pic, it is a sequence, I control three loads, the problem is when one of these loads is activated, which is a selenoid, my sequence is reset ... and I want to rule out that it is a programming problem, which I do not believe because at times it is going well, ooo that it is the assembly of the circuit ... that is not using the appropriate resistors or the ideal transistors ...

Responder
sergiouasd
sergiouasd
3.527
hace 5 años

you must feed the pic
independent of the other elements, so use a regulator only for the pic and its peripherals, do not put motor or anything in those 5v since it resets it, also verify that the voltage is not falling when you activate the solenoid and check the resistor of the MCL that is not lazy and is about 10k to 4.7k.

Responder
Reparaciones similares solucionadas

¿Conoces una solución?

¡Aprende a reparar con estos cursos YoReparo!

4.84
(25)

Curso Práctico de Reparación y Bobinado de Motores Eléctricos

Héctor Castiñeira
$ 60 USD
$ 20 USD
4.73
(22)

Curso Reparación de Fuentes Conmutadas de PC y Equipos Electrónicos

Maximiliano Resch
$ 40 USD
$ 20 USD
4.6
(10)

Curso Localización de Fallas en Refrigeración en Heladeras/Neveras On/Off

Yamil Alarcón
$ 29 USD
$ 12 USD
¿Tienes una mejor respuesta a este tema? ¿Quieres hacerle una pregunta a nuestra comunidad y sus expertos?
Regístrate gratis