EL PICAXE Microcontroladores ELPICAXE08 M Carlos E Canto

  • Slides: 26
Download presentation
EL PICAXE Microcontroladores ELPICAXE-08 M Carlos E. Canto Quintal M. C.

EL PICAXE Microcontroladores ELPICAXE-08 M Carlos E. Canto Quintal M. C.

EL PICAXE Microcontroladores ELPICAXE-08 M • El PICAXE-08 M usa el PIC 12 F

EL PICAXE Microcontroladores ELPICAXE-08 M • El PICAXE-08 M usa el PIC 12 F 683 que tiene el doble de memoria que el PIC 12 F 629 usado con el PICAXE-08 original. Por eso el PICAXE-08 M tiene la capacidad de reproducir música y mucho más. Carlos E. Canto Quintal M. C.

EL PICAXE Microcontroladores ELPICAXE-08 M El PICAXE-08 M soporta todos los comandos estándar y

EL PICAXE Microcontroladores ELPICAXE-08 M El PICAXE-08 M soporta todos los comandos estándar y carcterísticas del PICAXE-08 con las siguientes mejoras: · La memoria de programa ha sido doblada en capacidad ( aprox. 80 líneas de código). · Capacidad de tocar melodías generados por el usuario o cuatro melodías preprogramados (comandos PLAY y TUNE). · Opción de DAC de 10 bits en tres terminales (comandos READ-ADC 10/READADC). · Habilidad de interrupción en las entradas (comando SETINT). · Entrada y salida para Control remoto infrarojo ( comandos INFRAIN 2/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/READTEMP 12). · Lectura de cualquier dispositivo Dallas de 1 -wire (como el i. Button) (comando READOWSN). · Soporta software para una frecuencia de reloj aumentada (8 MHz) (comando SETFREQ). Carlos E. Canto Quintal M. C.

Microcontroladores EL PICAXE Tocar música con un PICAXE-08 M • • El principal obstáculo

Microcontroladores EL PICAXE Tocar música con un PICAXE-08 M • • El principal obstáculo cuando se toca música en un microcontrolador PIC es el limitado espacio de memoria. Todos los chips PICAXE tienen un comando SOUND para hacer ruidos, sin embargo, el número de notas y velocidad de reproducción o “tempo”, es muy limitado ya que el dato del comando SOUND consume toda la memoria de programa disponible. . Para resolver esto, el PICAXE-08 M tiene el comando nuevo TUNE para reproducir música. El comando TUNE incorpora un algoritmo de compresión de datos de la nota para ahorrar espacio de memoria, también viene programado con 4 melodías : Happy Birthday, Jingle Bells, Noche de Paz y Rodolfo el Reno de la nariz roja. Además puede ser programado con los tonos de timbre de los teléfonos 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 mayoría de los teléfonos Nokia. Un microcontrolador simple no puede reproducir melodías complicadas “polifónicas”, pero se oyen bien las melodías “monofónicas” (un tono a la vez). Carlos E. Canto Quintal M. C.

Microcontroladores EL PICAXE Tocar música con un PICAXE-08 M Esta representación de teclado de

Microcontroladores EL PICAXE Tocar música con un PICAXE-08 M Esta representación 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-08 M Carlos E. Canto Quintal M. C.

Microcontroladores EL PICAXE Tocar música con un PICAXE-08 M El byte de codificación de

Microcontroladores EL PICAXE Tocar música con un PICAXE-08 M El byte de codificación de cada nota usado por el comando TUNE. Carlos E. Canto Quintal M. C.

loop: infrain 'wait for new signal if infra = 1 then swon 1 'switch

loop: infrain 'wait for new signal if infra = 1 then swon 1 'switch on 1 if infra = 2 then swon 2 'switch on 2 if infra = 3 then swon 3 'switch on 3 if infra = 4 then swoff 1 'switch off 1 if infra = 5 then swoff 2 'switch off 2 if infra = 6 then swoff 3 'switch off 3 goto loop swon 1: high 1 goto loop swon 2: high 2 goto loop swon 3: high 3 goto loop swoff 1: low 1 goto loop swoff 2: low 2 goto loop swoff 3: low 3 goto loop with PICAXE-08 M input 3 must be used instead of input 0)

El bus I 2 C Microcontroladores Dispositivos I 2 C con el PICAXE Instrucciones

El bus I 2 C Microcontroladores Dispositivos I 2 C con el PICAXE Instrucciones del PICAXE para usar el bus I 2 CSLAVE WRITEI 2 C Sintáxis: I 2 CSLAVE slave, speed, address Sintáxis: WRITEI 2 C location, (variable, . . . ) - Location es una variable /constante que especifica la dirección de un byte o palabra - Variable(s) contiene el byte(s) de dato que se va a escribir Función: Escribe a la localidad I 2 C el contenido de la variable(s). - Slave es la dirección i 2 c del esclavo - Speed es la palabra i 2 cfast (400 k. Hz) o i 2 cslow (100 k. Hz) a 4 Mhz -Address es la palabra i 2 cbyte o i 2 cword Función: El comando i 2 cslave es usado para configurar las terminales PICAXE para usar el I 2 C y para definir el tipo de dispositivo I 2 C a ser direccionado READI 2 C Sintáxis: READI 2 C location, (variable, . . . ) - Location es una variable /constante que especifica la dirección de un byte o palabra - Variable(s) recibe el byte(s) leido(s). Funcción: Lee la localidad I 2 C contenida en la(s) variable(s). M. C. Carlos E. Canto Quintal

El bus I 2 C Microcontroladores M. C. Carlos E. Canto Quintal

El bus I 2 C Microcontroladores M. C. Carlos E. Canto Quintal

Comandos del PICAXE (válidos para todos los tamaños): SALIDA - high, low, toggle, pulsout,

Comandos del PICAXE (válidos para todos los tamaños): 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 - for…next MATEMÁTICAS - let… (+, -, *, **, /, //, max, min, &, |, ^, &/, |/, ^/ ) VARIABLES - if. . . then, random, lookdown, lookup MEMORIA DE DATOS - eeprom, write, read RETARDOS - pause, wait, nap, sleep, end MISCELÁNEO - symbol, debug

Commandos Específicos del PICAXE-08/08 M : CONFIG. E/S - input, output, reverse, let dirs

Commandos Específicos del PICAXE-08/08 M : CONFIG. E/S - input, output, reverse, let dirs = PWM - pwm, pwmout (08 M) MÚSICA - play, tune (08 M) RAM - peek, poke (08 M) SERVO CONTROL - servo (08 M) INFRAROJO - infrain 2, infraout (08 M) INTERRUPCIÓN - setint (08 M) ADC DE 10 BITS - readadc 10 (08 M) TEMPERATURA - readtemp, readtemp 12 (08 M) 1 -WIRE SERIAL NO - readowsn (08 M) ENTRADA DE CONTEO - count (08 M) SALIDA SERIAL - sertxd (08 M) VELOCIDAD DEL RESONADOR - setfreq (08 M)

Comandos Específicos del PICAXE-18/18 A/18 X : RAM - peek, poke SERVO CONTROL -

Comandos Específicos del PICAXE-18/18 A/18 X : RAM - peek, poke SERVO CONTROL - servo (18 A/X) INFRARED - infrain (18 A/X) INTERRUPT - setint (18 A/X) 10 BIT ADC - readadc 10 (18 X) TEMPERATURE - readtemp, readtemp 12 (18 A/X) KEYBOARD - keyin, keyled (18 A/X) 1 -WIRE SERIAL NO - readowsn (18 A/X) 1 -WIRE CLOCK - readowclk, resetowclk (18 A) I 2 C - readi 2 c, writei 2 c, i 2 cslave (18 X) COUNT INPUT - count (18 X) PWM OUTPUT - pwmout (18 X) SERIAL OUTPUT - sertxd (18 X) RESONATOR SPEED - setfreq (18 X)

Commandos Específicos del PICAXE-28/28 A/28 X(40 X) • MEMORIA DE DATOS - writemem, readmem

Commandos Específicos del PICAXE-28/28 A/28 X(40 X) • MEMORIA DE DATOS - writemem, readmem (28/28 A)

Processor Hardware Variante PICmicro Flash RAM [1] EEPROM PICAXE-08 M PICAXE-18 A PICAXE-18 X

Processor Hardware Variante PICmicro Flash RAM [1] EEPROM PICAXE-08 M PICAXE-18 A PICAXE-18 X PICAXE-28 A PICAXE-28 X PICAXE-40 X 12 F 629 12 F 683 16 F 627 16 F 819 16 F 88 16 F 872 16 F 873 A 16 F 874 A 1 K 2 K 4 K 2 K 2 K 4 K 4 K None [2] 48 : $50 -$7 F 96 : $50 -$7 F / $C 0 -$EF [4] 48 : $50 -$7 F 96 : $50 -$7 F / $C 0 -$EF 48 : $50 -$7 F 112 : $50 -$7 F / $C 0 -$FF 128 [3] 256 [5] 64+256 [5][6] 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 $C 0. . $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 Digital In Digital Out Analogue In PICAXE-08 1 -4 [1] 0

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

Advanced Interfacing Variant I 2 C [1] PICAXE-08 M PICAXE-18 A PICAXE-18 X PICAXE-28

Advanced Interfacing Variant I 2 C [1] PICAXE-08 M PICAXE-18 A PICAXE-18 X PICAXE-28 A PICAXE-28 X PICAXE-40 X Yes Yes Temp [2] Serial Num [3] Yes Yes Yes [1] General Purpose I 2 C / DS 1307 Clock - I 2 CSLAVE, READI 2 C, WRITEI 2 C [2] DS 18 B 20 One-Wire Temperature Sensor - READTEMP, READTEMP 12 [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 - INFRAIN 2, INFRAOUT IR [4] Yes [6] Yes Yes Yes Keyboard [5] Yes Yes