Escolar Documentos
Profissional Documentos
Cultura Documentos
EL PICAXE
Microcontroladores
EL PICAXE
Microcontroladores
EL PICAXE
Microcontroladores
EL PICAXE
goto main
regresa al inicio
Microcontroladores
EL PICAXE
Microcontroladores
EL PICAXE
play
Syntax:
PLAY tune,LED
- Tune is a variable/constant (0 - 3) which specifies which tune to play
0 - Happy Birthday 1 - Jingle Bells 2 - Silent Night 3 - Rudolf the Red Nosed Reindeer
- LED is a variable/constant (0 -3) which specifies if other outputs flash at the same time as the tune is being played.
0 - No outputs 1 - Output 0 flashes on and off 2 - Output 4 flashes on and off 3 - Output 0 and 4 flash alternately
Function: Play an internal tune on the PICAXE-08M (i/o pin2). Description: The PICAXE-08M can play musical tones. The PICAXE-08M is supplied with 4 pre-programmed internal tunes, which can be output via the play command. As these tunes are included within the PICAXE-08M bootstrap code, they use very little program memory. To generate your own tunes use the tune command, although this requires a much greater amount of program memeory. See the Tune command for suitable piezo / speaker circuits. Affect of increased clock speed: The tempo (speed) of the tune is doubled at 8MHz! Example: play 3,1 rudolf red nosed reindeer with output 0 flashingpoke Carlos E. Canto Quintal M.C.
Microcontroladores
EL PICAXE
Una Resistencia Dependiente de Luz (LDR) es una resistencia que cambia su valor de acuerdo a la luz que incide en ella. A commonly used device, the ORP-12, has a high resistance in the dark, and a low resistance in the light.
Connecting the LDR to the microcontroller is very straight forward, but some software calibrating is required.
It should be remembered that the LDR response is not linear, and so the readings will not change in exactly the same way as with a potentiometer. In general there is a larger resistance change at brighter light levels. This can be compensated for in the software by using a smaller range at darker light levels. Experiment to find the most appropriate settings for the circuit. Its resistance changes with light level. In bright light its resistance is low (typically around 1k). In darkness its resistance is high (typically around 1M)
Microcontroladores
EL PICAXE
main: readadc 0,b1 lee el valor if b1<50 then light1 rango 0-50= 50 if b1<100 then light2 rango 50-100 = 50 if b1<145 then light3 rango 100-145 = 45 if b1<175 then light4 rango 145-175 = 30 goto main
Microcontroladores
EL PICAXE
El PICAXE-08
Microcontroladores
EL PICAXE
El PICAXE-08
Procesador Real Memoria de Programa Lmite del tamao del cdigo fuente Salidas digitales PIC 12F629-I/P 128 bytes 40 lneas promedio 4 lneas, una fija, 3 de acceso programable individualmente o todas las lneas. Capacidad de manejo directo de LEDs/ piezoelctrico 4 lneas, una fija, 3 de acceso programable individual o todas las lneas 1 lnea que corresponde a una lnea de las entradas digitales 4 bits el 30% del voltaje alto de entrada no se usa No ver salida PWM Cualquiera de las 4 salidas digitales . Slamnente mientras se ejecuta el comando PWM Cualquiera de las 4 entradas digitales Mximo 2400 bps Cualquiera de las 4 salidas digitales. Mximo 2400 bps Interno 4MHz RC
Carlos E. Canto Quintal M.C.
Entradas Digitales Entradas Analgicas Resolucin Anloga Salida Anloga Salida PWM Entrada Serial Salida Serial Oscilador
Microcontroladores
EL PICAXE
ENTRADA DIGITAL
SALIDA ANLOGA
SOUND Emite un sonido. 0 = sin sonido, 255 = hiss. Sound 2, (100, 20) suena en el pin 2 un tono de 5Khz, por 0.2 s
Valores de las Notas : A(49), As(51), B(54), C(57), Cs(61), D(65), Ds(71), E(78), F(88), Fs(101), G(119) PWM proporciona a una salida una seal de Modulacin de Ancho de Pulso (PWM). PWM 1, 50, 10 pulsa el pin 1, con un ciclo de trabajo 50/255, 10 ciclos
EL PICAXE
Lee el canal anlogo a una variable. Read 1, b0 lee el pin 1 anlogo a b0 Establish a FOR-NEXT loop. For b1=0 to 100 step 10 Counts in tens Jump to address specified by offset Jump to address. If b1=5 goto motoroff Jump to subroutine at address. Return from subroutine Compare and conditionally jump Perform variable mathematics. Lookup data specified by offset and store in variable. Find targets match number (0-N) and store in variable Generate a pseudo-random number
FLUJO DE PROGRAMA
MANIPULACIN DE VARIABLES
SERIAL I/O
SEROUT SERIN Output serial data from output pin. Serout 0, n2400, (65) pin 0, 2400 bps, send ASCII 65 Serial input data on input pin. Serin 0, n2400, ("A") pin 0, 2400 bps, waits for ASCII 65
Microcontroladores
EL PICAXE
BAJA DE POTENCIA
NAP SLEEP END
MISCELNEA
PAUSE WAIT DEBUG