Está en la página 1de 26

Microcontroladores

EL PICAXE

ELPICAXE-08M

Carlos E. Canto Quintal M.C.

Microcontroladores

EL PICAXE

ELPICAXE-08M
El PICAXE-08M usa el PIC12F683 que tiene el doble de memoria que el PIC12F629 usado con el PICAXE-08 original. Por eso el PICAXE-08M tiene la capacidad de reproducir msica y mucho ms.

Carlos E. Canto Quintal M.C.

Microcontroladores

EL PICAXE

ELPICAXE-08M
El PICAXE-08M soporta todos los comandos estndar y carctersticas del PICAXE-08 con las siguientes mejoras:
La memoria de programa ha sido doblada en capacidad ( aprox. 80 lneas de cdigo). Capacidad de tocar melodas generados por el usuario o cuatro melodas preprogramados (comandos PLAY y TUNE). Opcin de DAC de 10 bits en tres terminales (comandos READ-ADC10/READADC). Habilidad de interrupcin en las entradas (comando SETINT). Entrada y salida para Control remoto infrarojo ( comandos INFRAIN2/INFRAOUT). Salida PWM para manejo continuo de motor (comando PWMOUT ) Control de servos de tipo de radio control (comando SERVO ). Conteo de pulsos de alta frecuencia dentro de un periodo de tiempo habilitado ( comando COUNT). Interface para sensor exacto de temperatura (comando READTEMP/READTEMP12). Lectura de cualquier dispositivo Dallas de 1-wire (como el iButton) (comando READOWSN). Soporta software para una frecuencia de reloj aumentada (8 MHz) (comando SETFREQ). Carlos E. Canto Quintal M.C.

Microcontroladores

EL PICAXE

Tocar msica con un PICAXE-08M


El principal obstculo cuando se toca msica en un microcontrolador PIC es el limitado espacio de memoria . Todos los chips PICAXE tienen un comando SOUND para hacer ruidos, sin embargo, el nmero de notas y velocidad de reproduccin o tempo, es muy limitado ya que el dato del comando SOUND consume toda la memoria de programa disponible. . Para resolver esto, el PICAXE-08M tiene el comando nuevo TUNE para reproducir msica . El comando TUNE incorpora un algoritmo de compresin de datos de la nota para ahorrar espacio de memoria, tambin viene pre programado con 4 melodas : Happy Birthday, Jingle Bells, Noche de Paz y Rodolfo el Reno de la nariz roja. Adems puede ser programado con los tonos de timbre de los telfonos celulares que se prefiera. Los tonos de los celulares se pueden bajar de internet en formato Ring Tone Text Transfer (RTTTF), como los que se usan en la mayora de los telfonos Nokia . Un microcontrolador simple no puede reproducir melodas complicadas polifnicas, pero se oyen bien las melodas monofnicas (un tono a la vez).

Carlos E. Canto Quintal M.C.

Microcontroladores

EL PICAXE

Tocar msica con un PICAXE-08M

Esta representacin de teclado de un piano muestra las frecuencias claves en octavas 5, 6 y 7. Este es el rango de frecuencias cubiertos por el PICAXE-08M Carlos E. Canto Quintal M.C.

Microcontroladores

EL PICAXE

Tocar msica con un PICAXE-08M

El byte de codificacin de cada nota usado por el comando TUNE.

Carlos E. Canto Quintal M.C.

loop:
infrain 'wait for new signal if infra = 1 then swon1 'switch on 1 if infra = 2 then swon2 'switch on 2 if infra = 3 then swon3 'switch on 3 if infra = 4 then swoff1 'switch off 1 if infra = 5 then swoff2 'switch off 2 if infra = 6 then swoff3 'switch off 3

goto loop

swon1: high 1
goto loop

swon2: high 2
goto loop

swon3: high 3
goto loop

with PICAXE-08M input3 must be used instead of input0)

swoff1: low 1
goto loop

swoff2: low 2
goto loop

swoff3: low 3
goto loop

El bus I2C

Microcontroladores

Dispositivos I2C con el PICAXE


Instrucciones del PICAXE para usar el bus I2C
I2CSLAVE
Sintxis: I2CSLAVE slave, speed, address - Slave es la direccin i2c del esclavo - Speed es la palabra i2cfast (400kHz) o i2cslow (100kHz) a 4Mhz -Address es la palabra i2cbyte o i2cword Funcin: El comando i2cslave es usado para configurar las terminales PICAXE para usar el I2C y para definir el tipo de dispositivo I2C a ser direccionado

WRITEI2C
Sintxis: WRITEI2C location,(variable,...) - Location es una variable /constante que especifica la direccin de un byte o palabra - Variable(s) contiene el byte(s) de dato que se va a escribir Funcin: Escribe a la localidad I2C el contenido de la variable(s).

READI2C
Sintxis: READI2C location,(variable,...) - Location es una variable /constante que especifica la direccin de un byte o palabra - Variable(s) recibe el byte(s) leido(s). Funccin: Lee la localidad I2C contenida en la(s) variable(s).
M.C. Carlos E. Canto Quintal

El bus I2C

Microcontroladores

M.C. Carlos E. Canto Quintal

Comandos del PICAXE (vlidos para todos los tamaos):


SALIDA - high, low, toggle, pulsout, let pins ENTRADA- if(and/or)...then, readadc, pulsin, button SONIDO - sound SERIAL - serin, serout FLUJO DEL PROGRAMA - goto, gosub, return, branch LOOPS - fornext MATEMTICAS - let (+, -, *, **, /, //, max, min, &, |, ^, &/, |/, ^/ ) VARIABLES - if...then, random, lookdown, lookup MEMORIA DE DATOS - eeprom, write, read RETARDOS - pause, wait, nap, sleep, end MISCELNEO - symbol, debug

Commandos Especficos del PICAXE-08/08M :


CONFIG. E/S - input, output, reverse, let dirs = PWM - pwm, pwmout (08M) MSICA - play, tune (08M) RAM - peek, poke (08M) SERVO CONTROL - servo (08M) INFRAROJO - infrain2, infraout (08M) INTERRUPCIN - setint (08M) ADC DE10 BITS - readadc10 (08M) TEMPERATURA - readtemp, readtemp12 (08M) 1-WIRE SERIAL NO - readowsn (08M) ENTRADA DE CONTEO - count (08M) SALIDA SERIAL - sertxd (08M) VELOCIDAD DEL RESONADOR - setfreq (08M)

Comandos Especficos del PICAXE-18/18A/18X :


RAM - peek, poke SERVO CONTROL - servo (18A/X) INFRARED - infrain (18A/X) INTERRUPT - setint (18A/X) 10 BIT ADC - readadc10 (18X) TEMPERATURE - readtemp, readtemp12 (18A/X) KEYBOARD - keyin, keyled (18A/X) 1-WIRE SERIAL NO - readowsn (18A/X) 1-WIRE CLOCK - readowclk, resetowclk (18A) I2C - readi2c, writei2c, i2cslave (18X) COUNT INPUT - count (18X) PWM OUTPUT - pwmout (18X) SERIAL OUTPUT - sertxd (18X) RESONATOR SPEED - setfreq (18X)

Commandos Especficos del PICAXE-28/28A/28X(40X)


MEMORIA DE DATOS - writemem, readmem (28/28A)

Processor Hardware
Variante PICmicro Flash RAM [1] EEPROM

PICAXE-08 PICAXE-08M PICAXE-18 PICAXE-18A PICAXE-18X PICAXE-28 PICAXE-28A PICAXE-28X PICAXE-40X

12F629 12F683 16F627 16F819 16F88 16F872 16F872 16F873A 16F874A

1K 2K 1K 2K 4K 2K 2K 4K 4K

None [2] 48 : $50-$7F 96 : $50-$7F / $C0-$EF [4] 48 : $50-$7F 96 : $50-$7F / $C0-$EF 48 : $50-$7F 48 : $50-$7F 112 : $50-$7F / $C0-$FF 112 : $50-$7F / $C0-$FF

128 [3] 256 [3] 128 [3] 256 [3] 256 [5] 64+256 [5][6] 64+256 [5][6] 128 [5] 128 [5]

[1] SFR available to user using PEEK and POKE commands [2] PEEK and POKE commands not supported [3] User program stored in EEPROM, shared with EEPROM data [4] It is not recommended to use $C0..$EF in order to retain upwards compatability [5] EEPROM data separate to user program [6] 64 bytes using READ/WRITE, plus 256 bytes using READMEM/WRITEMEM

Basic Interfacing
Variant PICAXE-08 PICAXE-08M PICAXE-18 PICAXE-18 PICAXE-18X PICAXE-288 Digital In 1-4 [1] 1-4 [1] 2-5 [2] 2-5 [2] 2-5 [2] 8 Digital Out 1-4 [1] 1-4 [1][4] 8 8 8 [4] 4 Analogue In 0-1 Low Res [2] 0-3 [2] 0-3 Low Res [2] 0-3 [2] 0-3 [2] No PWM 0-4 Burst [3] 0-1 Continuous No No 0-1 Continuous 0-8 SERVO No 0-4 No 0-8 0-8

PICAXE-28
PICAXE-28X PICAXE-40X

8
0-12 [1][2] 8-16 [1]

8
8-16 [1][4] 8-16 [1][4]

4
0-4 [2] 3-7 [2]

No
0-2 Continuous 0-2 Continuous

0-8
0-8 0-8

Advanced Interfacing
Variant PICAXE-08 PICAXE-08M PICAXE-18 PICAXE-18A PICAXE-18X PICAXE-28 PICAXE-28A PICAXE-28X PICAXE-40X I2C [1] Yes Yes Yes Temp [2] Serial Num [3] Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes IR [4] Yes [6] Yes Yes Yes Yes Yes Yes Keyboard [5] Yes Yes Yes Yes

[1] General Purpose I2C / DS1307 Clock - I2CSLAVE, READI2C, WRITEI2C [2] DS18B20 One-Wire Temperature Sensor - READTEMP, READTEMP12 [3] One-Wire Serial Number - READOWSN [4] IR Input Sensor - INFRAIN, IF INFRA [5] PC keyboard Interface - KEYIN, IF KEYVALUE, KEYLED [6] IR Input and Output Interfaces - INFRAIN2, INFRAOUT

También podría gustarte