Está en la página 1de 33

Audio CRO

P1 P2 P3
Hogar

PIC12F675 Hoja de datos (.pdf 4,926KB)


Juego de instrucciones para PIC12F675
Programador PIC MkV

Juego de instrucciones para PIC12F629


Datos PIC12F629 (pdf)
BlankF629.asm

PIC12F629.inc

Ver más proyectos usando micros:


Pic A PIC Project

Notepad2.zip Notepad2.exe
Biblioteca de subrutinas "Cortar y pegar "
Biblioteca de rutinas: AE EP PZ

AudioCRO.asm
AudioCRO.hex

Este proyecto es un CRO de audio en miniatura. Para aquellos que no están familiarizados con la
abreviatura "CRO", significa "osciloscopio de rayos catódicos" y esto a veces se acorta a "ALCANCE u O-
Scope".

Un "CRO" es un equipo de prueba con una pantalla. Produce una indicación visual de una forma de
onda, a través de una sonda, cuando la forma de onda está conectada al terminal de entrada del CRO.
Si conecta un micrófono a la sonda y silba en el micrófono, el CRO producirá una imagen (traza) de la
forma de onda. Tendrá la forma de una onda sinusoidal. La pantalla es muy similar a un televisor de estilo
antiguo (llamado "tubo de imagen") y la imagen se crea disparando un haz de electrones desde la parte
posterior del tubo (llamado "cuello") al frente de El tubo donde una capa de material fosforescente brilla
cuando el rayo lo golpea.
El haz de electrones se desvía de izquierda a derecha a través de un campo electromagnético o un
campo electrostático y esto produce una línea a través de la pantalla.
El haz se desvía hacia arriba o hacia abajo por campos magnéticos o electrostáticos a 90 ° y esto le
permite producir todo tipo de patrones.
Aquí hay algunas fotos del prototipo de Audio CRO. Tenga en cuenta que el uso de componentes de
montaje en superficie permite colocar muchas piezas en un espacio muy pequeño.
El inductor de 10mH se ha colocado en ángulo para que sea menos sensible a los imanes del motor, de
modo que solo capte el campo del superimán colocado en el extremo del motor.
El motor es en realidad un motor de 12v del mecanismo de expulsión de un reproductor de CD. Funciona
a 3v y las RPM a 3v son muy bajas. Por eso fue elegido.
Hay muchos desafíos técnicos que superar cuando la electrónica se combina con dispositivos
mecánicos. Experimentarás esto cuando construyas el proyecto.

Esto es exactamente lo que hemos hecho en este proyecto. Pero de una manera extremadamente
miniaturizada.
Nuestra pantalla es digital. Está girando para producir una pantalla de luz compuesta de "píxeles".
Tenemos una tira vertical de LED y esto se gira de izquierda a derecha para crear una pantalla de 8 píxeles
de alto.
Como puede ver en las fotos, el proyecto se basa en una pequeña placa de PC que contiene el chip PIC,
componentes para conectar una bobina y un micrófono al chip y 4 celdas. 16 LEDs se sueldan al borde de
la placa para crear la "pantalla". La placa de PC se suelda al eje de un motor y se usa un suministro de 3v
separado para rotar el motor. Hemos utilizado la detección electromagnética para detectar el punto de
partida para cada rotación de la pantalla, de modo que las RPM del motor no sean importantes. La pantalla
se mantendrá absolutamente estable, no importa cuán rápido gire el eje.
Sin embargo, la longitud de la pantalla se contraerá si el motor se desacelera.
Luego, encendemos y apagamos cada LED muchas veces durante la parte visual de su rotación,
haciendo una resolución de pantalla de hasta 8 x 60. (Pero la sección de audio tiene un tamaño de pantalla
de 8 x 48). Esto puede parecer un área pequeña pero el proyecto es un DISEÑO DE CONCEPTO.

DISEÑO CONCEPTUAL
Está diseñado para mostrar las capacidades de uno de los chips más pequeños y simples en la gama de
microcontroladores PIC. Es para "comenzar" y si fuera un proyecto complejo, sería ignorado por aquellos a
quienes apuntamos: el PRINCIPIANTE.
Incluso en este nivel básico hay una serie de características para desafiar al aficionado más brillante, así
que prepárate para un proyecto realmente absorbente.

MITO DEL LED


Existe un pensamiento generalmente aceptado de que el voltaje a través de un LED es un valor bastante
constante. Pero esto no es así.
A medida que la corriente a través de él cae, la "caída de voltaje característica" también cae
significativamente.
Para los LED utilizados en este proyecto, el voltaje cae de 2.3v (cuando fluye la corriente completa) a
1.66v cuando fluye menos de 1mA.
Este valor es importante ya que estamos colocando 4 LED en un suministro de 5.4v y necesitamos saber
si fluirá alguna corriente a través de la combinación cuando el proyecto esté en reposo.
En nuestro caso, 4 LED en reposo requieren 6.64v Esto significa que no fluirá corriente cuando el
suministro es de 5.4v (tiene que ser superior a 5,4v para que los LED comiencen a conducir).
Esta es la razón principal por la que hemos tenido que colocar dos LED en serie en cada salida. Si
tuviéramos solo 2 LED desde el riel positivo al riel 0v (con la salida del chip conectada al punto medio), se
iluminarían cuando la línea de transmisión estuviera en "modo de entrada (modo de alta impedancia)".

LA PANTALLA
La pantalla está hecha de 16 LED. Los LED están en pares y esto hace 8 "píxeles". Dos LED están
conectados desde una salida al riel positivo y dos LED al riel negativo.
Cuando una línea de control es ALTA, dos LED se iluminan y cuando está BAJA, los otros dos se
iluminan. Cuando la línea de control es una entrada, ninguna se ilumina.
Ambos pares de LED no se pueden iluminar al mismo tiempo.
Para que la pantalla parezca estable, los LED deben encenderse exactamente en el mismo instante,
durante cada revolución. Esto se llama REGISTRO y se realiza detectando el flujo magnético de un imán y
confiando en el voltaje producido por un transistor amplificador para ser detectado como ALTO por GP3, la
línea de solo entrada.
Tenemos un problema adicional con la visualización de una forma de onda de audio.
Necesitamos SINCRONIZAR la rotación de la pantalla con el audio. Con un CRO, esto se realiza a
través de una función llamada "activación".
El haz se mantiene en el lado izquierdo de la pantalla hasta que la señal alcanza un cierto valor y esto
hace que cada forma de onda (llamada traza) vuelva sobre la anterior para producir una imagen estable.
Como no podemos sincronizar el audio con la rotación de la pantalla, hemos utilizado una función
inteligente llamada SAMPLE AND HOLD.
Muestramos el audio para producir 48 "puntos" y los almacenamos en registros de 30h a 5Fh.
El programa luego espera el comienzo de la próxima revolución y muestra estos 48 puntos. Luego
espera el comienzo de la próxima revolución y muestra los puntos nuevamente. Lo hace 30 veces y toma
otra muestra del audio. Esto produce alrededor de 2 actualizaciones por segundo.
El resultado es una imagen muy estable.
Entonces, ahí lo tienes. Un CRO de audio de muestra y espera.

UTILIZANDO EL AUDIO CRO


Encienda el proyecto, luego encienda el motor.
La pantalla girará y la bobina recogerá la ubicación de inicio de la pantalla.
Las palabras "Audio CRO" aparecerán en la pantalla, luego se desplazarán a la izquierda. Cuando el
título se ha movido fuera de la pantalla, puede silbar al micrófono. El chip tomará una muestra y almacenará
48 datos.
Estos se mostrarán en la próxima rotación. La imagen aparecerá en la pantalla durante 30 revoluciones y
luego se tomará otra muestra.
Esto permite que la forma de onda se vea como una traza bastante estable.
La resolución es muy baja, pero la traza mostrará una onda sinusoidal y al silbar a diferentes
frecuencias, podrá obtener diferentes efectos en la pantalla.
El propósito de este proyecto es prepararte para una mayor experimentación. Hemos utilizado a
propósito el chip más pequeño, más barato y más simple de la gama para que pueda comenzar.
Toda la ayuda para hacer esto está en la web.
En realidad, consta de cientos de páginas de archivos y datos y todo es accesible al instante,
simplemente conectándose a la web.
También puede acceder a un sitio web de PIC Micro (http://www.electro-tech-online.com/) donde
cualquier consulta será respondida, las 24 horas del día, por técnicos de todo el mundo.

POV
Mencionamos anteriormente, el chip no puede mostrar todos los píxeles al mismo tiempo, ya que un
ALTO en una salida muestra uno de los pares de píxeles y el BAJO muestra el otro par de píxeles.
Para crear letras e imágenes en la pantalla, todos los LED deben estar iluminados en algún momento.
Para lograr esto, creamos las imágenes en la pantalla en DOS ESCANEOS. La primera pasada o
exploración muestra todos los píxeles inferiores y la segunda exploración muestra todos los píxeles
superiores. Dado que la rotación de la pantalla es bastante rápida, las dos imágenes se combinan y todos
los píxeles en la pantalla "aparecen" para mostrarse.
Esto es el resultado de que su ojo sostenga una imagen anterior durante un corto período de tiempo y la
combine con la siguiente.
Así funcionan las películas y la televisión. Se llama PERSISTENCIA DE VISIÓN (POV) y permite
combinar imágenes parpadeantes, por encima de 5 parpadeos por segundo.
PIC12F629 y PIC12F675
Talking Electronics presenta dos de los chips PIC de 8 pines más simples en sus proyectos. Estos chips
son: PIC12F629 y PIC12F675.
Son idénticos, excepto que el PIC12F675 tiene cuatro canales AD y PIC12F629 no tiene ninguno.
Este proyecto requiere un canal AD y, por lo tanto, se ha elegido el PIC12F675.
El proyecto viene con un chip preprogramado, pero si desea programar el chip usted mismo o modificar
el programa, el sitio web de Talking Electronics tiene detalles de un programador (PICkit-2), un zócalo de
programación (placa de PC) y un adaptador que se conecta entre El programador y el tablero de
programación.

REGISTROS
La pantalla está compuesta por 8 LED y estos se encienden y apagan rápidamente para crear "píxeles" y
el resultado es una imagen "en el aire".
Para mantener la imagen estacionaria, necesitamos encender los LED exactamente en el mismo lugar
durante cada revolución.
Esto se hace con una bobina "pick-up" e imán. El flujo del imán produce un voltaje y este es amplificado
por un transistor y alimentado al microcontrolador como ALTO.
Esto proporciona registro para la pantalla y funciona muy bien, produciendo un resultado muy estable.
Pero la bobina de captación es muy sensible y detectará el magnetismo de los imanes permanentes del
motor.
Para evitar que la bobina recoja el campo de fondo, la hemos inclinado a 45 ° y hemos agregado un
100n entre la base y 0v. También hemos reducido la ganancia del transistor a 10 agregando una resistencia
de emisor. Debe asegurarse de que la bobina detecte el magnetismo solo una vez por revolución,
preferiblemente desde el imán colocado en el cuerpo del motor.

MODO DE ATRACCIÓN
Cuando se activa el proyecto, la pantalla muestra "Audio CRO" y las letras se desplazan hacia la
izquierda hasta que la pantalla está en blanco.
Este proyecto no está destinado principalmente a mostrar letras, ya que esta función está disponible en
otro de nuestros proyectos. Sin embargo, se ha incluido una subrutina para mostrar las capacidades de la
pantalla.
Esto nos lleva a...

ESCRIBIR UN PROGRAMA
Usar un microcontrolador es como recibir un cuaderno en blanco. Puede escribir una novela, un informe
científico o crear casi cualquier cosa en una hoja de papel.
Lo mismo con un microcontrolador, excepto que la escritura se realiza electrónicamente, con líneas de
código llamadas instrucciones que se llaman mnemónicas, ya que cada instrucción consiste en letras de
una oración, para representar la instrucción. Las posibilidades con un micro tan simple como el PIC12F675
son casi infinitas. Es por eso que hemos superado los límites con este micro para mostrar lo que se puede
hacer.
Lo primero que debe hacer es determinar qué requisitos necesita y ver si se ajustan a las capacidades
del chip.
El chip que hemos usado tiene 5 líneas de entrada y una de ENTRADA (GP3, pin4). También tiene
cuatro entradas de analógico a digital, almacenamiento de datos retenidos, incluso cuando el chip está
apagado (llamado EEPROM) y temporizadores que contienen "valores de conteo", así como otras
características.
Desde el punto de vista de los principiantes, es muy difícil saber qué puede hacer un micro y la única
forma de generar este conocimiento es mirar los proyectos utilizando un micro particular y estudiar el
programa.
En lugar de intentar reinventar la rueda, la forma más sencilla de comenzar a programar es tomar un
proyecto escrito previamente y cargarlo en un editor de texto como NotePad2 y usarlo como plantilla.
Una plantilla contiene todos los datos para el micro y el diseño general de las subrutinas. Al mantener un
diseño estándar, podrá encontrar todas las subrutinas a medida que se colocan en orden alfabético, con las
Tablas primero, luego los retrasos y Main como la última rutina.
A continuación, podrá agregar sus propias subrutinas o "cortarlas y pegarlas" desde nuestra Biblioteca
de rutinas.
Puede encontrar más información sobre este tema en el sitio web de Talking Electronics en artículos
como " Comience aquí con PIC12F629 ".
En este punto, solo queremos mencionar que este proyecto es un punto de partida para muchas ideas y
la pantalla es como un lienzo en blanco para todo tipo de animaciones y efectos.

PROGRAMACIÓN EN LENGUAJE DE ENSAMBLAJE


Hay varias formas de crear el programa para este proyecto. Algunos requieren que aprendas un idioma
antes de que pueda comenzar la programación. Hemos decidido utilizar las 35 instrucciones que vienen con
el microcontrolador.
Estas instrucciones son fáciles de leer ya que cada instrucción consta de letras que representan una
oración.
Esto se llama LENGUAJE DE ENSAMBLAJE y cuando crea un programa de esta manera, está
programando en mnemotecnia. Un mnemotécnico es un conjunto de letras o números que puede leer un
humano y que el programador puede recordar fácilmente.
Por ejemplo, "btfss 2C, 3" representa la operación: "prueba de bit 3 en el archivo 2C y omita la siguiente
instrucción si está configurada". Todas las operaciones para nuestro micro se pueden realizar utilizando
aproximadamente 35 instrucciones.
Cada línea de un programa contiene una sola instrucción y justo antes de que el micro se "queme", se
utiliza un programa de software llamado ensamblador para cambiar las instrucciones en bytes que el micro
puede leer. El ensamblador producirá bytes "hexadecimales" y creará un archivo con la extensión .hex
La siguiente pieza de software que usará se llama Programador y tomará el archivo .hex y lo convertirá a
"1" y "0" binarios para "grabar" en el chip.
Este proceso se llama "programación".
El uso de mnemónicos se denomina lenguaje de bajo nivel porque la instrucción puede ser leída casi
directamente por el micro.
Puede usar lenguajes de nivel superior (como C) en los que una sola instrucción realizará una tarea más
compleja que una de nuestras instrucciones mnemónicas, pero a medida que avanza en la escala de
programación, se aleja aún más de la comprensión del lenguaje PIC.
Nuestra intención es mostrar qué se puede hacer con un simple chip PIC de 8 pines y cómo se escribe
un programa.
Hemos simplificado la programación al poner las 35 instrucciones en una lista y los programas de
muestra están disponibles en el sitio web de Talking Electronics.
Al copiar y pegar una subrutina (o incluso una sola instrucción), no puede cometer un error. Simplemente
mantenga el mismo diseño de cada instrucción y colóquelos en la columna correcta (el diseño de un
programa se puede ver en la subrutina a continuación).
No hay complicaciones de sintaxis, como el orden de colocar corchetes o comprender qué significan
símbolos como "/, ^, &&" y si sigue nuestras pautas de "copiar y pegar" y "agregar una o dos instrucciones a
la vez" Tendrás éxito.

CÓMO FUNCIONA EL PROGRAMA


Los archivos para este proyecto son:
AudioCRO.asm
AudioCRO.hex

El programa se clasifica como "muy simple" porque no utiliza instrucciones complejas. Una instrucción
compleja es aquella que es "muy inteligente" y proporciona un resultado que no es inmediatamente obvio.
Muchas de las instrucciones booleanas producen una respuesta de que tienes que crear físicamente una
tabla de verdad para ver el resultado. Otras instrucciones pueden cambiar un poco a través del "carry" a
otro archivo y esto no es inmediatamente obvio. Las únicas instrucciones que necesitan algún estudio son
aquellas relacionadas con el direccionamiento indirecto.
No hemos tratado de engañarte con habilidades de programación. Cada instrucción es clara y obvia.
Pero debe recordar que estamos produciendo un resultado bastante elaborado, que sorprendería a los
espectadores si se presentara como una pantalla de 2 metros en un poste de 10 metros. Una vez que se
comprende el concepto de registro, visualización de un píxel, desplazamiento y almacenamiento de datos
temporales, los resultados se pueden ampliar a cualquier dimensión.
El programa comienza configurando el convertidor A / D y otras "tareas domésticas" necesarias.
El micro luego va a Main y ejecuta una subrutina llamada Attract.
En Attract, el micro realiza un bucle constante, esperando que la bobina pase el imán y cree un ALTO en
la línea de entrada GP3.
Tan pronto como se detecte ALTO, Attract crea una pantalla de 8 píxeles de alto x 60 píxeles de largo,
haciendo un bucle de un programa 60 veces.
El ancho de la pantalla es más de 300 ° de circunferencia y es más de lo que se puede ver a la vez. Es
por eso que las letras se desplazan hacia la izquierda y eventualmente "caen" la pantalla.
El chip no es capaz de emitir todos los 8 píxeles al mismo tiempo, por lo que se necesitan dos pases de
un programa para generar los datos por completo. Los píxeles 1, 3, 5 y 7 se muestran en Pass-1 y los
píxeles 2,4,6 en Pass-2. La rotación de la pantalla es lo suficientemente rápida como para combinarlos para
producir una pantalla completa.
Para iluminar píxeles para Pass-1, las líneas de salida deben ser BAJAS. Esto se aplica a todos los LED
que queremos iluminar para la primera pasada y, dado que esto es común a todos los 60 bytes de datos,
podemos colocar estas instrucciones en la subrutina.
Todo lo que tenemos que hacer es determinar qué líneas se harán BAJAS. Esto se puede controlar
cargando el registro "tris". Este registro determina si una línea es INPUT o OUTPUT.
Si es entrada, la línea será de alta impedancia y no tendrá efecto en el control de un LED.
Esto es lo que hemos hecho.
La tabla contiene bits para el registro "tris" y crea una ENTRADA o SALIDA. Cuando una línea se
convierte en una ENTRADA, se convierte en ALTA IMPEDANCIA y no tiene ningún efecto en la iluminación
de ningún LED. Cuando se hace SALIDA, es BAJO y enciende el LED requerido.
Así es como activamos los píxeles que necesitamos.
Cada byte en la Tabla 1 solo determina los valores para los píxeles 1, 3, 5 y 7 a través de GP1,2,4 y 5. El
programa enciende los LED deseados y llama un breve retraso para producir el ancho del píxel.
A continuación, las líneas de puerto se apagan (se hacen de alta impedancia) y un breve retraso crea la
brecha entre píxeles.
El programa realiza un bucle 60 veces para obtener 60 columnas de datos para producir lo que llamamos
los "valores entrelazados" para "Audio CRO ".
El programa luego pasa a la segunda mitad de la rutina y produce los otros 4 valores entrelazados.
Esta vez, los bits de la Tabla 2, para el registro "tris", determinan si una línea es ENTRADA o SALIDA y
el programa hace que cada línea sea ALTA. Esto enciende los LED requeridos. Por el fenómeno de la
persistencia de la visión, el resultado de los dos medios entrelazados, produce "Audio CRO ".
Simplemente sucede que estas dos subrutinas se ejecutan 60 veces y luego el micro regresa a Main
donde ejecuta nuevamente la subrutina Attract.
Pero esta vez se introduce un valor de "búsqueda" en las tablas y esto hace que el micro salte hacia
abajo de la tabla y tome un valor y lo muestre como la primera columna. Esto tiene el efecto de desplazar
toda la pantalla hacia la izquierda y eventualmente , después de 49 recuperaciones, todas las letras se han
desplazado de la pantalla.
La velocidad de desplazamiento hacia la izquierda se determina cargando el archivo "shift" con "1" y esto
permite realizar dos escaneos medios antes de desplazarse hacia la izquierda.
Tan pronto como toda la redacción se ha eliminado de la pantalla, el micro pasa a la siguiente sección
llamada Main1 donde espera a que la bobina pase el imán. Esto se ha hecho para que el micrófono esté
frente al usuario. Se toman 48 muestras en rápida sucesión y se colocan en archivos de 30h a 5Fh.
Luego, el programa espera el registro a través de la bobina y muestra los 48 puntos en la pantalla.
El valor de cada muestra se obtiene mediante una sección dentro del chip (llamada Convertidor
analógico a digital) que detecta el voltaje en GP0 y crea un valor de 00 a 0FF (00 a 256) cargando un
pequeño condensador dentro del chip y determinar cuánto tarda en cargarse a través de una resistencia.
La forma de onda producida por el micrófono y el amplificador de transistores no es muy alta y hemos
tomado las 10 unidades más bajas del valor A / D para representar el LED1, las siguientes 10 para el LED 2,
etc. Esto no es científico ni es exacto, pero el efecto es producir unos pocos píxeles en la pantalla para
representar una onda sinusoidal.
El programa genera los 48 puntos para 30 revoluciones y esto produce aproximadamente 0.5 segundos
para cada imagen.
Si sigue silbando, la pantalla se actualizará aproximadamente dos veces por segundo.

Ese es el programa.

Solo usa 400 bytes y aún hay más de 600 bytes disponibles para agregar nuevas funciones.
El programa se puede mejorar de muchas maneras. Por ejemplo, las dos tablas se pueden combinar en
una y el programa selecciona los bits para el primer pase y luego los bits para el segundo pase a través de
unas pocas instrucciones de transferencia.
O puede agregar más al mensaje cuando el proyecto está activado.
En lugar de producir una línea para mostrar la forma de onda de audio, puede usar un gráfico de barras,
sin embargo, esto requeriría un doble paso; de la misma manera, las letras se producen en la subrutina
Attract.
Hay 8 archivos no utilizados que podrían usarse para proporcionar 8 puntos más para la forma de onda
de audio.
Y luego hay algunas ideas que no he pensado.

;Audio CRO 12F675.asm


; LED giratorios con entrada de micrófono
; 19-1-2010

list p=12F675
radix dec
include "p12f675.inc"

errorlevel -302 ; No te quejes


; sobre los registros del BANCO 1 durante el
montaje

__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF


& _INTRC_OSC_NOCLKOUT

;****************************************************************
; variables - nombres y archivos
;****************************************************************
shift equ 20h ; primer archivo disponible
fetch equ 21h
loops equ 22h

fileA equ 23h


fileB equ 24h
fileC equ 25h
temp1 equ 26h
test equ 27h

; 30h ; primera ubicación para almacenar el valor A_D

; 5Fh ; última ubicación para el valor A_D


; 3 x 16 = 48 ubicaciones
; la memoria termina en 5Fh

status equ 03h


option_reg equ 81h

; bits en GPIO

pin7 equ 0 ; GP0


pin6 equ 1 ; GP1
pin5 equ 2 ; GP2 y T0CkI
pin4 equ 3 ; solo entrada GP3
pin3 equ 4 ; GP4
pin2 equ 5 ; GP5

; bits

rp0 equ 5 ; bit 5 del registro de estado

;****************************************************************
; Inicio del programa
;****************************************************************
Start org 0x00 ; el programa comienza en la ubicación 000
nop
nop
nop
nop ; NOP para pasar la dirección de reinicio del vector
nop
nop

SetUp bsf status, rp0 ; Banco 1


movlw b'11111111' ; Establecer entrada GPI0
movwf TRISIO
clrf vrcon ; Vref apagado (apaga el comparador - ahorra
energía)
movlw b'01110001' ; 111 establece oscilador interno
movwf ansel ; GP0 = analógico - otros digital
bcf status, rp0 ; banco 0
bsf ADCON0,0 ; encienda el convertidor A/D - bit 0 = 1
bcf ADCON0,7 ; resultado justificado a la izquierda en ADRESH
(faltan 2 más bajos)
movlw 07h ; Configurar para apagar los puertos del
comparador
movwf CMCON ; debe colocarse en el banco 0
clrf GPIO ; Borrar GPIO de basura
goto Main

;*************************************
;* Tablas *
;*************************************

; Tabla1 para el primer pase de letras en pantalla

Table1 addwf 02,1 ; Agregue W al Contador de programas para


crear un salto
retlw b'01000011'
retlw b'01000011' ; línea 1
retlw b'01101101' ;
retlw b'01101101' ; "1" produce una entrada = LED apagado
retlw b'01101101'
retlw b'01101101' ; línea 5
retlw b'01000011'
retlw b'01111111'
retlw b'01000111'
retlw b'01111111'
retlw b'01111111' ; línea 10

retlw b'01111111'
retlw b'01000111'
retlw b'01111111'
retlw b'01011111'
retlw b'01100111' ; línea 15
retlw b'01100111'
retlw b'01100111'
retlw b'01000001'
retlw b'01111111'
retlw b'01000111' ; línea 20

retlw b'01111111'
retlw b'01011111'
retlw b'01100111'
retlw b'01100111'
retlw b'01100111' ; línea 25
retlw b'01011111'
retlw b'01111111'
retlw b'01000011'
retlw b'01000001'
retlw b'01011101' ; línea 30

retlw b'01011101'
retlw b'01011101'
retlw b'01011001'
retlw b'01011011'
retlw b'01111111' ; línea 35
retlw b'01000011'
retlw b'01000001'
retlw b'01110101'
retlw b'01100101'
retlw b'01110101' ; línea 40

retlw b'01000001'
retlw b'01100011'
retlw b'01111111'
retlw b'01000011'
retlw b'01000001' ; línea 45
retlw b'01011101'
retlw b'01011101'
retlw b'01011101'
retlw b'01000001'
retlw b'01000011' ; línea 50
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

; Tabla2 para el segundo pase para letras en pantalla

Table2 addwf 02,1 ; Agregue W al Contador de programas para


crear un salto
retlw b'01000001'
retlw b'01000001' ; línea 1
retlw b'01111111' ;
retlw b'01111111'
retlw b'01111111'
retlw b'01111111' ; línea 5
retlw b'01000001'
retlw b'01111111' ; "1" produce una entrada = LED apagado
retlw b'01100111'
retlw b'01011111'
retlw b'01011111' ; línea 10

retlw b'01011111'
retlw b'01100111'
retlw b'01111111'
retlw b'01101111'
retlw b'01010111' ; línea 15
retlw b'01010111'
retlw b'01010111'
retlw b'01100001'
retlw b'01111111'
retlw b'01000001' ; línea 20

retlw b'01111111'
retlw b'01101111'
retlw b'01010111'
retlw b'01010111'
retlw b'01010111' ; línea 25
retlw b'01101111'
retlw b'01111111'
retlw b'01100001'
retlw b'01000001'
retlw b'01011101' ; línea 30

retlw b'01011101'
retlw b'01011101'
retlw b'00001001'
retlw b'01101001'
retlw b'01111111' ; línea 35
retlw b'01000001'
retlw b'01000001'
retlw b'01110101'
retlw b'01110101'
retlw b'01100101' ; línea 40
retlw b'01110001'
retlw b'01010001'
retlw b'01111111'
retlw b'01101001'
retlw b'01000001' ; línea 45
retlw b'01011101'
retlw b'01011101'
retlw b'01011101'
retlw b'01000001'
retlw b'01101001' ; línea 50

retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

;************************************
;* Retardos *
;************************************
; Retardo 250uS

_250uS movlw 30h


movwf fileB
Del250 nop
decfsz fileB,1
goto Del250
retlw 00

; Retardo 0.01 sec (10mS)

_10mS movlw 0Ah


movwf fileB
DelY nop
decfsz fileA,1
goto DelY
decfsz fileB,1
goto DelY
retlw 00

;************************************
;* Sub rutinas *
;************************************

; modo de atracción: muestra Audio CRO en el inicio

attract
bsf status, rp0 ; Banco 1
movlw b'11111111' ; Establecer entrada GP3 - buscar magnetismo
inductor
movwf TRISIO
bcf status, rp0 ; banco 0
btfss gpio,3
goto $-1
; Produce el primer pase

movlw 00
movwf fetch ; obtiene valor de la tabla
movf shift,w ; desplazamiento para buscar
addwf fetch,f
movf fetch,0 ; pon el valor de fetch en w
call Table1
bsf status, rp0 ; Banco 1
movwf TRISIO ; Establecer tris entrada/salida
bcf status, rp0 ; banco 0
movlw b'00000000' ; hacer GPIO BAJO
movwf GPIO
call _250uS ; pantalla por poco tiempo
call _00percent ; todos los LED apagados
call _250uS ; espacio entre píxeles
incf fetch,f
movlw d'60'
xorwf fetch,w ; ¿es fetch = 60?
btfss 03,2 ; indicador de prueba cero en estado z = 1
cuando es igual
goto $-.14

; Produce un segundo pase

bsf status, rp0 ; Banco 1


movlw b'11111111' ; Establecer entrada GP3 - buscar magnetismo
inductor
movwf TRISIO
bcf status, rp0 ; banco 0
btfss gpio,3
goto $-1
movlw 00
movwf fetch ; obtiene valor de la tabla
movf shift,w ; desplazamiento para buscar
addwf fetch,f
movf fetch,0 ; pon el valor de fetch en w
call Table2
bsf status, rp0 ; Banco 1
movwf TRISIO ; Establecer tris entrada/salida
bcf status, rp0 ; banco 0
movlw b'11111111' ; hacer GPIO HIGH
movwf GPIO
call _250uS ; pantalla por poco tiempo
call _00percent ; todos los LED apagados
call _250uS ; espacio entre píxeles
incf fetch,f
movlw d'60'
xorwf fetch,w ; ¿es fetch = 60?
btfss 03,2 ; indicador de prueba cero en estado z = 1
cuando es igual
goto $-.14
retlw 00

convert ; convierte el valor A/D en 4 líneas de salida

movwf test ; cargue el valor A/D en el archivo "prueba"


(2F)
movlw d'10' ; carga decimal en w
subwf test,0 ; restar d '' de la prueba
btfss 03,0 ; prueba la bandera de acarreo
goto _10percent ; el indicador de acarreo está SET si w es
menor que "test"
movwf test ; cargue el valor A/D en el archivo "prueba"
(2F)
movlw d'20' ; carga decimal en w
subwf test,0 ; restar d'' de la prueba
btfss 03,0 ; prueba la bandera de acarreo
goto _20percent ; el indicador de acarreo está SET si w es
menor que "test"

movwf test ; cargue el valor A/D en el archivo "prueba"


(2F)
movlw d'30' ; carga decimal en w
subwf test,0 ; restar d'' de la prueba
btfss 03,0 ; prueba la bandera de acarreo
goto _30percent ; el indicador de acarreo está SET si w es
menor que "test"

movwf test ; cargue el valor A/D en el archivo "prueba"


(2F)
movlw d'40' ; carga decimal en w
subwf test,0 ; restar d '' de la prueba
btfss 03,0 ; prueba la bandera de acarreo
goto _40percent ; el indicador de acarreo está SET si w es
menor que "test"

movwf test ; cargue el valor A/D en el archivo "prueba"


(2F)
movlw d'50' ; carga decimal en w
subwf test,0 ; restar d '' de la prueba
btfss 03,0 ; prueba la bandera de acarreo
goto _50percent ; el indicador de acarreo está SET si w es
menor que "test"

movwf test ; cargue el valor A / D en el archivo


"prueba" (2F)
movlw d'60' ; carga decimal en w
subwf test,0 ; restar d'' de la prueba
btfss 03,0 ; prueba la bandera de acarreo
goto _60percent ; el indicador de acarreo está SET si w es
menor que "test"

movwf test ; cargue el valor A/D en el archivo "prueba"


(2F)
movlw d'70' ; carga decimal en w
subwf test,0 ; restar d '' de la prueba
btfss 03,0 ; prueba la bandera de acarreo
goto _70percent ; el indicador de acarreo está SET si w es
menor que "test"

goto _80percent ; el indicador de acarreo está SET si w es


menor que "test"

_00percent ; TODOS los LED apagados


bsf status, rp0 ; Banco 1
movlw b'11111111' ; Establecer todas las entradas GP0
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00000000' ; sin LED encendidos
movwf GPIO
retlw 00

_10percent
bsf status, rp0 ; Banco 1
movlw b'11011111' ; Establecer entrada GP0 GP5 como salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00100000' ; hacer GP 5 alto
movwf GPIO
retlw 00

_20percent
bsf status, rp0 ; Banco 1
movlw b'11011111' ; Establecer entrada GP0 GP5 como salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00000000' ; hacer GP 5 bajo
movwf GPIO
retlw 00

_30percent
bsf status, rp0 ; Banco 1
movlw b'11101111' ; Establecer GP0 2 4 5 entrada GP4 como
salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00010000' ; hacer GP 4 alto
movwf GPIO
retlw 00

_40percent
bsf status, rp0 ; Banco 1
movlw b'11101111' ; Establecer GP0 2 5 entrada GP4 como salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00000000' ; hacer GP 4 bajo
movwf GPIO
retlw 00

_50percent
bsf status, rp0 ; Banco 1
movlw b'11111011' ; Establecer GP0 2 5 entrada GP2 como salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00000100' ; hacer GP 2 alto
movwf GPIO
retlw 00

_60percent
bsf status, rp0 ; Banco 1
movlw b'1111011' ; Establecer entrada GP0 GP2 como salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00000000' ; hacer GP 2 bajo
movwf GPIO
retlw 00

_70percent
bsf status, rp0 ; Banco 1
movlw b'1111101' ; Establecer entrada GP0 GP1 como salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00000010' ; hacer GP 1 alto
movwf GPIO
retlw 00

_80percent
bsf status, rp0 ; Banco 1
movlw b'11111101' ; Establecer entrada GP0 GP1 como salida
movwf TRISIO
bcf status, rp0 ; banco 0
movlw b'00000000' ; hacer GP 1 bajo
movwf GPIO
retlw 00
;*************************************
;* Principal *
;*************************************

; Muestra "Audio CRO"


; llamado "modo de atracción"

Main clrf shift ; mueve la pantalla a la izquierda agregando


desplazamiento para buscar
movlw .60
movwf loops ; número de bucles antes de que la pantalla
comience a cambiar
call attract
decfsz loops,f
goto $-2

; cambia el mensaje por la pantalla

incf shift,f
movlw .1 ; = decimal 1
movwf loops ; número de bucles antes de los cambios de
visualización
call attract
movlw d'49' ; número de turnos antes de la salida
xorwf shift,w ; ¿shift = 49?
btfsc 03,2 ; indicador de prueba cero en estado z = 1
cuando es igual
goto $+4
decfsz loops,f
goto $-6
goto $-.10 ; = 10 decimal

; almacena 48 valores en archivos de 30h a 5Fh

Main1 bsf status, rp0 ; Bank 1


movlw b'11111111' ; Establecer entrada GP3 - buscar magnetismo
inductor
movwf TRISIO
bcf status, rp0 ; banco 0
btfss gpio,3
goto $-1
movlw 30h ; primera ubicación para almacenar el valor A_D
movwf 04h ; poner valor en Archivo Seleccionar Registrarse
bsf ADCON0,1 ; Iniciar A/D en GP0 (pin 7)
btfsc ADCON0,1 ; ¿ha finalizado la conversión?
goto $-1
movf ADRESH,w ; poner el resultado de la conversión en w
movwf 00h ; mover el valor a INDF (en realidad 30h +)
incf 04h,f ; incremente FSR a 31h, etc.
movlw 5Fh
xorwf 04h,w ; es el archivo 04h = 5Fh
btfss 03,2 ; indicador de prueba cero en estado z = 1
cuando es igual
goto $-9 ; ¿los bucles han alcanzado el archivo 5Fh? No

; muestra 48 valores en la pantalla

movlw d'30'
movwf loops ; crea el tiempo de actualización de 0.5
segundos para ver la pantalla
bsf status, rp0 ; Banco 1
movlw b'11111111' ; Establecer entrada GP3 - buscar magnetismo
inductor
movwf TRISIO
bcf status, rp0 ; banco 0
btfss gpio,3
goto $-1
movlw 30h ; primera ubicación para el valor A_D
movwf 04h ; poner valor en Archivo Seleccionar Registrarse
movf 00h,w ; mover el valor de INDF (30h +) a w
call convert
call _250uS ; pantalla por poco tiempo
call _00percent ; todos los LED apagados
nop ; espacio entre píxeles
incf 04h,f ; incremente FSR a 31h, etc.
movlw 5Fh
xorwf 04h,w ; es el archivo 04h = 5Fh
btfss 03,2 ; indicador de prueba cero en estado z = 1
cuando es igual
goto $-9
decfsz loops,1 ; los bucles alcanzaron el archivo 5Fh?
goto $-.19
goto Main1

; calibración del oscilador

call 03ffh
movwf OSCCAL
end

MÁS EN LA WEB
Este proyecto es mucho más complejo de lo que parece. Sin embargo, no queremos disuadirlo y es por
eso que hay un chip preprogramado disponible con el kit.
Hay muchos detalles disponibles sobre el uso de chips PIC, la creación de programas, etc., y estos se
pueden encontrar en la web simplemente buscando en Google PIC12F629 y / o PIC12F675.
La web es definitivamente el invento más increíble desde el "tipo móvil" y dado que es el resultado de
millones de contribuyentes individuales, encontrará una enorme cantidad de asistencia en: "PIC Micro
Webring". Además, encontrará información en el "sitio web de Talking Electronics". Haga clic en: "Fish Shop
Timer" en el índice de la izquierda.

PROGRAMANDO EL CHIP
El chip se puede programar utilizando el "Programador de múltiples chips" de Talking Electronics
(aproximadamente $ 16.00) y el cable serial ($ 6.00) o el Programador PIC MkV (sin kit para este proyecto,
pero su costo es inferior a $ 10.00) o el programador MicroChip PICkit-2 (aproximadamente $ 65.00) más un
conector de 5/6 pines ($ 3.00) y un zócalo de programación (placa de programación de PCB - $ 3.50) de
Talking Electronics.
Aquí está el descuidado.

UTILIZANDO MULTI CHIP PROGRAMMER o PIC Programmer MkV:


El chip PIC de 8 pines se saca del zócalo en el proyecto y se ajusta al zócalo MkV del programador de
múltiples chips o programador PIC y se "quema". Luego se vuelve a poner en el proyecto.
Esto es muy fácil de hacer.
Debe tener un puerto serie en su computadora y la mayoría de las computadoras antiguas (como
"escritorio" y "torres" tienen un puerto serie de 9 pines en la parte posterior de la computadora) para que
pueda hacer esto. El software para grabar el chip es IC-PROG. Está disponible en el sitio web de Talking
Electronics , así como en archivos MPASM, NotePad2 e .inc.
Esto le ayuda a comenzar a programar por menos de $ 30.00.

UTILIZANDO PICkit-2:
Si no tiene un puerto serie (como una computadora portátil), deberá comprar el programador PICkit-2 de
Microchip (de Modtronix en Australia) y usar el puerto USB.
La mayoría (todas) de las computadoras portátiles tienen un puerto USB y este programador viene con 2
discos que contienen todo el software que necesita.
Este programador también es muy fácil de usar y funciona siempre.
También deberá ensamblar el conector de 5/6 pines (de Talking Electronics - $ 3.50) que conecta el
programador al proyecto.

El PICkit-2 está disponible como un kit con un chip preprogramado para la placa de PC PICkit-2 en:
http://www.auelectronics.com/Hardware-CB0703.htm por aproximadamente $ 34.99 (USD) como BB0703 -
Función completa Sistema PICkit 2 Parte #: BB0703. Pero los 2CD's de software no están incluidos.
Las instrucciones de montaje se pueden encontrar aquí:
http://augroups.blogspot.com/2009/02/step-by-step-assembly-guide-for-cb0703.html
pero el costo del kit es casi el mismo que el de los kits completamente ensamblados de MicroChip:
http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164120 (costo $ 50.00 USD más
gastos de envío o de Modtronix en Australia ). El PICkit-2 de MicroChip es un "paquete" que también
contiene 2 CD y una placa de PC adicional que se conecta al programador para poder programar cualquier
micro de 8, 14 y 20 pines. El tablero contiene 4 LED, un botón y una olla, así como algunas tierras
adicionales para que pueda crear un pequeño proyecto.

Para los residentes australianos, PICkit-2 se puede comprar en Modtronix por aproximadamente $ 50.00
USD más gastos de envío y esto incluye 2 CD de software. Pero no estoy seguro si la placa adicional
mencionada anteriormente está incluida en el "paquete".
El conector de 5/6 pines que conecta el programador a nuestro proyecto debe comprarse en Talking
Electronics $ 3.50; de lo contrario, deberá usar la placa de PC (llamada placa experimental) que viene con el
"paquete" de Microchip para sostener el chip. mientras se "quema" (programado).

20/5/2010
Audio CRO

P1 P2 P3
Home

PIC12F675 Data Sheet (.pdf 4,926KB)


Instruction Set for PIC12F675
PIC Programmer MkV

Instruction Set for PIC12F629


PIC12F629 data (pdf)
BlankF629.asm

PIC12F629.inc

See more projects using micros:


Pic A PIC Project

Notepad2.zip Notepad2.exe
Library of Sub-routines "Cut and Paste"
Library of routines: A-E E-P P-Z

AudioCRO.asm
AudioCRO.hex

This project is a miniature Audio CRO. For those not familiar with the abbreviation "CRO," it means
"Cathode Ray Oscilloscope" and this is sometimes shortened to "SCOPE or O-Scope."

A "CRO" is a piece of test equipment with a screen. It produces a visual indication of a waveform, via a
probe, when the waveform is connected to the input terminal of the CRO.
If you connect a microphone to the probe and whistle into the mic, the CRO will produce a picture (trace)
of the waveform. It will be in the shape of a sinewave. The screen is very similar to an old-style TV set (called
a "picture-tube") and the picture is created by firing a beam of electrons from the back of the tube (called the
"neck'") to the front of the tube where a layer of phosphorescent material glows when the beam hits it.
The beam of electrons is diverted from left to right via an electromagnetic field or an electrostatic field and
this produces a line across the screen.
The beam is then deflected up or down by magnetic or electrostatic fields at 90° and this enables it to
produce all sorts of patterns.
Here are some photos of the prototype Audio CRO. Note the use of surface-mount components allows a
lot of parts to be placed in a very small space.
The 10mH inductor has been placed at an angle to make it less sensitive to the motor magnets so that it
only picks up the field of the super-magnet placed on the end of the motor.
The motor is actually a 12v motor from the eject mechanism of a CD player. It operates down to 3v and
the RPM at 3v is very low. That's why it was chosen.
There are a lot of technical challenges to overcome when electronics is combined with mechanical
devices. You will experience these when you build the project.

This is exactly what we have done in this project. But in an extremely miniaturised way.
Our screen is digital. It is rotating to produce a screen of light made up of "pixels." We have an upright
strip of LEDs and this is spun from left to right to create a screen that is 8 pixels high.
As you can see from the photos, the project is built on a small PC board containing the PIC chip,
components to interface a pick-up coil and microphone to the chip and 4 cells. 16 LEDs are soldered to the
edge of the board to create the "display." The PC board is soldered to the shaft of a motor and a separate 3v
supply is used to rotate the motor. We have used electro-magnetic detection to detect the starting point for
each rotation of the display so that the RPM of the motor is not important. The display will remain absolutely
steady, not matter how fast the shaft is rotated.
However the length of the display will contract if the motor is slowed down.
We then turn each LED on and off many times during the visual part of its rotation, making a screen
resolution of up to 8 x 60. (But the audio section has a screen size 8 x 48). This might seem a small area but
the project is a CONCEPT DESIGN.

CONCEPT DESIGN
It is designed to show the capabilities of one of the smallest and simplest chips in the PIC microcontroller
range. It's to "get you started" and if it were a complex project, it would be by-passed by those who we are
aiming at - the BEGINNER.
Even at this basic level there are a number of features to challenge the brightest hobbyist - so be
prepared for a really absorbing project.

LED MYTH
There is a generally accepted thought that the voltage across a LED is a fairly constant value. But this is
not so.
As the current across it drops, the "characteristic voltage drop" also drops significantly.
For the LEDs used in this project, the voltage drops from 2.3v (when full current is flowing) to 1.66v when
less than 1mA flows.
This value is important as we are placing 4 LEDs across a 5.4v supply and we need to know if any
current will flow through the combination when the project is resting.
In our case, 4 LEDs at rest requires 6.64v This means no current will flow when the supply is 5.4v (it has
to be higher than 5,4v for the LEDs to start to conduct).
This is the main reason why we have had to place two LEDs in series on each output. If we had only 2
LEDs from the positive rail to 0v rail, (with the output of the chip connected to the mid-point) they would
illuminate when the drive-line was in "input-mode (high-impedance mode)."

THE DISPLAY
The display is made from 16 LEDs. The LEDs are in pairs and this makes 8 "pixels." Two LEDs are
connected from an output to the positive rail and two LEDs to the negative rail.
When a control line is HIGH, two LEDs are illuminated and when it is LOW, the other two are illuminated.
When the control line is an input, none are illuminated.
Both pairs of LEDs cannot be illuminated at the same time.
To make the display appear steady, the LEDs must be turned on at exactly the same instant, during each
revolution. This is called REGISTRATION and is done by sensing the magnetic flux from a magnet and
relying on the voltage produced by an amplifying transistor to be detected as a HIGH by GP3, the input-only
line.
We have one further problem with displaying an audio waveform.
We need to SYNCHRONISE the rotation of the display with the audio. With a CRO, this is done via a
feature called "triggering."
The beam is held at the left side of the screen until the signal reaches a certain value and this makes
every waveform (called a trace) retrace the previous to produce a steady picture.
Since we cannot synchronise the audio with the rotation of the display, we have used a clever feature
called SAMPLE AND HOLD.
We sample the audio to produce 48 "points" and store these in registers 30h to 5Fh.
The program then waits for the start of the next revolution and displays these 48 points. It then waits for
the start of the next revolution and displays the points again. It does this 30 times and takes another sample
of the audio. This produces about 2 updates every second.
The result is a very steady picture.
So, there you have it. A sample-and-hold audio CRO.

USING THE AUDIO CRO


Switch the project ON, then turn the motor on.
The display will rotate and the coil will pick up the starting-location for the display.
The words "Audio CRO" will appear on the display, then shift left. When the title has moved off-screen,
you can whistle into the microphone. The chip will take a sample and store 48 pieces of data.
These will be displayed on the next rotation. The image will appear on the screen for 30 revolutions then
another sample will be taken.
This allows the waveform to be viewed as a fairly steady trace.
The resolution is very low but the trace will show a sinewave and by whistling at different frequencies, you
will be able to get different effects on the screen.
The whole purpose of this project is to set you up for further experimentation. We have purposely used
the smallest, cheapest and simplest chip in the range to get you started.
All the help to do this is on the web.
It actually consists of hundreds of pages of files and data and everything is instantly accessible, simply by
connecting to the web.
You can also access a PIC Micro webring (http://www.electro-tech-online.com/) where almost any query
will be answered, 24 hours a day, by technical people around the world.

POV
We mentioned above, the chip is not able to display all the pixels at the same time, since a HIGH on an
output displays one of the pixel-pairs and the LOW displays the other pixel-pair.
To create letters and pictures on the display, all the LEDs need to be illuminated at some point in time. To
achieve this we create the images on the display in TWO SCANS. The first pass or scan displays all the
lower pixels and the second scan displays all the upper pixels. Since the rotation of the display is fairly rapid,
the two images combine and all the pixels on the screen "appear" to be displayed.
This is a result of your eye holding a previous image for a short period of time and combining it with the
next.
This is the way movies and television work. It is called PERSISTENCE OF VISION (POV) and allows
flickering images, above 5 flickers per second, to be combined.

PIC12F629 & PIC12F675


Talking Electronics features two of the simplest 8-pin PIC chips in their projects. These chips are:
PIC12F629 and PIC12F675.
They are identical except the PIC12F675 has four A-D channels and PIC12F629 has none.
This project requires an A-D channel and thus the PIC12F675 has been chosen.
The project comes with a pre-programmed chip but if you want to program the chip yourself or alter the
program, Talking Electronics website has details of a programmer (PICkit-2), a programming socket (PC
board) and an adapter that plugs between the programmer and Programming board.

REGISTRATION
The display is made up of 8 LEDs and these are pulsed on and off very quickly to create "pixels" and the
result is an image "in the air."
To keep the image stationary we need to turn on the LEDs at the exact same place during each
revolution.
This is done with a "pick-up" coil and magnet. The flux from the magnet produces a voltage and this is
amplified by a transistor and fed to the microcontroller as a HIGH.
This provides registration for the display and it works very well, producing a very steady result.
But the pick-up coil is very sensitive and will detect the magnetism from the permanent magnets of the
motor.
To prevent the coil picking up the background field we have angled it to 45° and added a 100n between
base and 0v. We have also reduced the gain of the transistor to 10 by adding an emitter resistor. You need
to make sure the coil detects magnetism only once per revolution - preferably from the magnet placed on the
body of the motor.

ATTRACT MODE
When the project is turned on, the screen shows "Audio CRO" and the letters shift left until the screen is
blank.
This project is not primarily intended to show lettering as this feature is available in another of our
projects. However a sub-routine has been included to show the capabilities of the display.
This leads us into . . .

WRITING A PROGRAM
Using a microcontroller is like being handed a blank notebook. You can write a novel, a science report or
create just about anything on a piece of paper.
The same with a microcontroller, except the writing is done electronically, with lines of code called
instructions that are called mnemonics, as each instruction consists of letters of a sentence, to represent the
instruction. The possibilities with a micro as simple as the PIC12F675 are almost endless. That's why we
have pushed the boundaries with this micro to show what can be done.
The first thing to do is work out what requirements you need and see if they fit into the capabilities of the
chip.
The chip we have used has 5 in-out lines and one INPUT-ONLY line (GP3, pin4). It also has four
Analogue-to-Digital inputs, storage of data that is retained, even when the chip is turned off (called
EEPROM) and timers that hold "count-values," as well as other features.
From a beginners standpoint it is very difficult to know what a micro can do and the only way to generate
this knowledge is to look at projects using a particular micro and study the program.
Rather than trying to re-invent the wheel, the simplest way to start programming is to take a pre-written
project and load it into a text editor such as NotePad2 and use it as a template.
A template contains all the data for the micro and the general layout of the sub-routines. By keeping to a
standard layout, you will be able to find all the sub-routines as they are placed in alphabetical order, with
Tables first, then delays and Main as the last routine.
You will then be able to add your own sub-routines or "cut and paste" them from our Library of Routines.
More on this topic can be found on Talking Electronics website in articles such as "Start Here with
PIC12F629."
At this point we just like to mention that this project is a starting point for lots of ideas and the screen is
like a blank canvas for all sorts of animations and effects.

PROGRAMMING IN ASSEMBLY LANGUAGE


There are a number of ways to create the program for this project. Some require you to learn a language
before programming can commence. We have decided to use the 35 instructions that come with the
microcontroller.
These instructions are easy to read as each instruction consists of letters that represent a sentence.
This is called ASSEMBLY LANGUAGE and when you create a program in this way, you are programming
in mnemonics. A mnemonic is a set of letters or numbers that can be read by a human and easily
remembered by the programmer.
For instance, "btfss 2C,3" represents the operation: "bit test 3 in file 2C and skip the next instruction if it is
set." All the operations for our micro can be performed using about 35 instructions.
Each line of a program contains a single instruction and just before the micro is "burnt," a software
program called an assembler is used to change the instructions into bytes that can be read by the micro. The
assembler will produce "hex" bytes and create a file with the extension .hex
The next piece of software you will use is called a Programmer and will take the .hex file and convert it to
binary "1's" and "0's" for "burning" into the chip.
This process is called "programming."
Using mnemonics is called a low-level language because the instruction can be almost directly read by
the micro.
You can use higher-level languages (such as C) in which a single instruction will perform a more-complex
task than one of our mnemonic instructions, but as you go further up the programming ladder you get further
removed from actually understanding PIC language.
Our intent is to show what can be done with a simple 8-pin PIC chip and how a program is written.
We have made programming very simple by putting the 35 instructions in a list and sample programs are
available on Talking Electronics website.
By copying and pasting a sub-routine (or even a single instruction), you cannot make a mistake. Just
keep to the same layout of each instruction and place them in the correct column (the layout of a program
can be seen in the sub-routine below).
There are no syntax complications, like the order of placing brackets or understanding what symbols like:
"/, ^, &&" mean and if you follow our guidelines of "copy and paste" and "add one or two instructions at a
time," you will have success.

HOW THE PROGRAM WORKS


The files for this project are:
AudioCRO.asm
AudioCRO.hex

The program is classified as "very simple" because it does not use any complex instructions. A complex
instruction is one that is "very clever" and provides a result that is not immediately obvious.
Many of the Boolean instruction produce an answer that you have to physically create a Truth Table to
see the result. Other instructions can shift a bit via the "carry" to another file and this is not immediately
obvious. The only instructions that need some study are those involved with Indirect Addressing.
We have not tried to trick you with programming skills. Each instruction is clear and obvious.
But you have to remember, we are producing a fairly elaborate result, one that would amaze onlookers if
it were presented as a 2 metre display on a 10 metre pole. Once the concept of registration, displaying a
pixel, shifting and storing temp data is understood, the results can be expanded to any dimension.
The program starts by setting-up the A/D converter and other necessary "housekeeping."
The micro then goes to Main and executes a sub-routine called Attract.
At Attract, the micro constantly loops, waiting for the coil to pass the magnet and create a HIGH on input
line GP3.
As soon as a HIGH is detected, Attract creates a display 8 pixels high x 60 pixels long, by looping a
program 60 times.
The width of the display is more than 300° in circumference and it is more than can be viewed at one
time. That's why the letters are shifted to the left and eventually "drop off" the screen.
The chip is not capable of outputting all the 8 pixels at the same time so that two passes of a program are
needed to fully output the data. Pixels 1, 3, 5 and 7 are displayed on Pass-1 and pixels 2,4,6 on Pass-2. The
rotation of the display is fast enough to combine them to produce a complete display.
To illuminate pixels for Pass-1 the output lines must be LOW. This applies to all the LEDs we want to
illuminate for the first pass and since this is common to all the 60 bytes of data, we can place these
instructions in the sub-routine.
All we have to do is determine which lines are to be made LOW. This can be controlled by loading the
"tris" register. This register determines if a line is INPUT or OUTPUT.
If it is input, the line will be high-impedance and have no effect on controlling a LED.
This is what we have done.
The Table contains bits for the "tris" register and it creates an INPUT or OUTPUT. When a line is made
into an INPUT, it becomes HIGH-IMPEDANCE and does not have any effect on illuminating any LEDs.
When it is made OUTPUT, it is LOW and turns on the required LED.
This is how we turn ON the pixels we need.
Each byte in Table1 only determines values for pixels 1, 3, 5 and 7 via GP1,2,4 and 5. The program turns
on the desired LEDs and calls a short delay to produce the width of the pixel.
Next the port-lines are turned off (made high-impedance) and a short delay creates the gap between
pixels.
The program loops 60 times to get 60 columns of data to produce what we call the "interlace values" for
"Audio CRO."
The program then goes to the second half of the routine and produces the other 4 interlace values.
This time the bits from Table2, for the "tris" register, determine if a line is INPUT or OUTPUT and the
program makes each line HIGH. This turns on the required LEDs. By the phenomenon of Persistence of
Vision, the result of the two half-interlaces, produces "Audio CRO."
It just happens that these two sub-routines are executed 60 times and then the micro returns to Main
where it executes the Attract sub-routine again.
But this time a "fetch' value is introduced to the Tables and this causes the micro to jump down the table
and pick up a value and display it as the first column. This has the effect of shifting the whole display to the
left and eventually, after 49 fetches, all the letters have been shifted off the display.
The speed of shifting left is determined by loading the "shift" file with "1" and this allows two half' scans to
be carried out before shifting-left.
As soon as all the wording has been shifted off the screen, the micro goes to the next section called
Main1 where it waits for the coil to pass the magnet. This has been done so that the microphone is facing the
user. 48 samples are taken in quick succession and placed in files 30h to 5Fh.
The program then waits for registration via the coil and outputs the 48 points on the display.
The value of each sample is obtained by a section inside the chip (called the Analogue-to-Digital
Converter) that detects the voltage on GP0 and creates a value from 00 to 0FF (00 to 256) by charging a
small capacitor inside the chip and determining how long it takes to charge via a resistor.
The waveform produced by the microphone and transistor amplifier is not very high and we have taken
the lowest 10 units of the A/D value to represent LED1, the next 10 for LED 2 etc. This is not scientific nor is
it accurate but the effect is to produce a few pixels on the screen to represent a sinewave.
The program outputs the 48 points for 30 revolutions and this produces approx 0.5sec for each image.
If you keep whistling, the screen will update approx twice per second.

That's the program.

It only uses 400 bytes and more than 600 bytes are still available for adding new features.
The program can be improved in so many ways. For example, the two Tables can be combined into one
and the program picks the bits for the first pass and then the bits for the second pass via a few transfer
instructions.
Or you can add more to the message when the project is turned on.
Instead of producing a line to show the audio waveform, you could use a bar-graph, however this would
require a double-pass; in the same way the letters are produced in the Attract sub-routine.
There are 8 unused files that could be used to supply 8 more points for the audio waveform.
And then there are some ideas I have not thought of.

;Audio CRO 12F675.asm


;Spinning LEDs with mic input
; 19-1-2010

list p=12F675
radix dec
include "p12f675.inc"

errorlevel -302 ; Don't complain


;about BANK 1 Registers during assembly

__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF


& _INTRC_OSC_NOCLKOUT

;****************************************************************
; variables - names and files
;****************************************************************
shift equ 20h ;first available file
fetch equ 21h
loops equ 22h

fileA equ 23h


fileB equ 24h
fileC equ 25h
temp1 equ 26h
test equ 27h

; 30h ;first location for storing A_D value

; 5Fh ;last location for A_D value


;3 x 16 = 48 locations
;memory ends at 5Fh

status equ 03h


option_reg equ 81h

; bits on GPIO

pin7 equ 0 ;GP0


pin6 equ 1 ;GP1
pin5 equ 2 ;GP2 and T0CkI
pin4 equ 3 ;GP3 input only
pin3 equ 4 ;GP4
pin2 equ 5 ;GP5
;bits

rp0 equ 5 ;bit 5 of the status register

;****************************************************************
;Beginning of program
;****************************************************************
Start org 0x00 ;program starts at location 000
nop
nop
nop
nop ;NOPs to get past reset vector address
nop
nop

SetUp bsf status, rp0 ;Bank 1


movlw b'11111111' ;Set GPI0 input
movwf TRISIO
clrf vrcon ;Vref off (power off the comparator - saves
power)
movlw b'01110001' ;111 sets internal oscillator
movwf ansel ;GPO = analogue - others digital
bcf status, rp0 ;bank 0
bsf ADCON0,0 ;turn A/D converter ON - bit 0=1
bcf ADCON0,7 ;left justified result in ADRESH (2 lowest
missing)
movlw 07h ;Set up to turn off Comparator ports
movwf CMCON ;must be placed in bank 0
clrf GPIO ;Clear GPIO of junk
goto Main

;*************************************
;* Tables *
;*************************************

;Table1 for first pass for letters on display

Table1 addwf 02,1 ;Add W to the Program Counter to create a


jump
retlw b'01000011'
retlw b'01000011' ;line 1
retlw b'01101101' ;
retlw b'01101101' ;"1" produces an input = LED OFF
retlw b'01101101'
retlw b'01101101' ;line 5
retlw b'01000011'
retlw b'01111111'
retlw b'01000111'
retlw b'01111111'
retlw b'01111111' ;line 10

retlw b'01111111'
retlw b'01000111'
retlw b'01111111'
retlw b'01011111'
retlw b'01100111' ;line 15
retlw b'01100111'
retlw b'01100111'
retlw b'01000001'
retlw b'01111111'
retlw b'01000111' ;line 20

retlw b'01111111'
retlw b'01011111'
retlw b'01100111'
retlw b'01100111'
retlw b'01100111' ;line 25
retlw b'01011111'
retlw b'01111111'
retlw b'01000011'
retlw b'01000001'
retlw b'01011101' ;line 30

retlw b'01011101'
retlw b'01011101'
retlw b'01011001'
retlw b'01011011'
retlw b'01111111' ;line 35
retlw b'01000011'
retlw b'01000001'
retlw b'01110101'
retlw b'01100101'
retlw b'01110101' ;line 40

retlw b'01000001'
retlw b'01100011'
retlw b'01111111'
retlw b'01000011'
retlw b'01000001' ;line 45
retlw b'01011101'
retlw b'01011101'
retlw b'01011101'
retlw b'01000001'
retlw b'01000011' ;line 50

retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

;Table2 for second pass for letters on display

Table2 addwf 02,1 ;Add W to the Program Counter to create a


jump
retlw b'01000001'
retlw b'01000001' ;line 1
retlw b'01111111' ;
retlw b'01111111'
retlw b'01111111'
retlw b'01111111' ;line 5
retlw b'01000001'
retlw b'01111111' ;"1" produces an input = LED OFF
retlw b'01100111'
retlw b'01011111'
retlw b'01011111' ;line 10

retlw b'01011111'
retlw b'01100111'
retlw b'01111111'
retlw b'01101111'
retlw b'01010111' ;line 15
retlw b'01010111'
retlw b'01010111'
retlw b'01100001'
retlw b'01111111'
retlw b'01000001' ;line 20

retlw b'01111111'
retlw b'01101111'
retlw b'01010111'
retlw b'01010111'
retlw b'01010111' ;line 25
retlw b'01101111'
retlw b'01111111'
retlw b'01100001'
retlw b'01000001'
retlw b'01011101' ;line 30

retlw b'01011101'
retlw b'01011101'
retlw b'00001001'
retlw b'01101001'
retlw b'01111111' ;line 35
retlw b'01000001'
retlw b'01000001'
retlw b'01110101'
retlw b'01110101'
retlw b'01100101' ;line 40

retlw b'01110001'
retlw b'01010001'
retlw b'01111111'
retlw b'01101001'
retlw b'01000001' ;line 45
retlw b'01011101'
retlw b'01011101'
retlw b'01011101'
retlw b'01000001'
retlw b'01101001' ;line 50

retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'
retlw b'01111111'

;************************************
;* Delays *
;************************************
;Delay 250uS

_250uS movlw 30h


movwf fileB
Del250 nop
decfsz fileB,1
goto Del250
retlw 00

;Delay 0.01 sec (10mS)

_10mS movlw 0Ah


movwf fileB
DelY nop
decfsz fileA,1
goto DelY
decfsz fileB,1
goto DelY
retlw 00

;************************************
;* Sub routines *
;************************************

;attract mode - displays Audio CRO on start-up

attract
bsf status, rp0 ;Bank 1
movlw b'11111111' ;Set GP3 input -look for inductor magnetism
movwf TRISIO
bcf status, rp0 ;bank 0
btfss gpio,3
goto $-1

;Produces first pass

movlw 00
movwf fetch ;gets value from table
movf shift,w ;offset for fetch
addwf fetch,f
movf fetch,0 ;put fetch value into w
call Table1
bsf status, rp0 ;Bank 1
movwf TRISIO ;Set tris input/output
bcf status, rp0 ;bank 0
movlw b'00000000' ;make GPIO LOW
movwf GPIO
call _250uS ;display for short time
call _00percent ;all LEDs off
call _250uS ;gap between pixels
incf fetch,f
movlw d'60'
xorwf fetch,w ;is fetch = 60?
btfss 03,2 ;test zero flag in status z=1 when same
goto $-.14

;Produces second pass

bsf status, rp0 ;Bank 1


movlw b'11111111' ;Set GP3 input -look for inductor magnetism
movwf TRISIO
bcf status, rp0 ;bank 0
btfss gpio,3
goto $-1
movlw 00
movwf fetch ;gets value from table
movf shift,w ;offset for fetch
addwf fetch,f
movf fetch,0 ;put fetch value into w
call Table2
bsf status, rp0 ;Bank 1
movwf TRISIO ;Set tris input/output
bcf status, rp0 ;bank 0
movlw b'11111111' ;make GPIO HIGH
movwf GPIO
call _250uS ;display for short time
call _00percent ;all LEDs off
call _250uS ;gap between pixels
incf fetch,f
movlw d'60'
xorwf fetch,w ;is fetch = 60?
btfss 03,2 ;test zero flag in status z=1 when same
goto $-.14
retlw 00

convert ;converts A/D value to 4 output lines

movwf test ;load the A/D value into the "test" file (2F)
movlw d'10' ;load decimal into w
subwf test,0 ;subtract d'' from test
btfss 03,0 ;test the carry flag
goto _10percent ;carry flag is SET if w is less than "test"

movwf test ;load the A/D value into the "test" file (2F)
movlw d'20' ;load decimal into w
subwf test,0 ;subtract d'' from test
btfss 03,0 ;test the carry flag
goto _20percent ;carry flag is SET if w is less than "test"

movwf test ;load the A/D value into the "test" file (2F)
movlw d'30' ;load decimal into w
subwf test,0 ;subtract d'' from test
btfss 03,0 ;test the carry flag
goto _30percent ;carry flag is SET if w is less than "test"

movwf test ;load the A/D value into the "test" file (2F)
movlw d'40' ;load decimal into w
subwf test,0 ;subtract d'' from test
btfss 03,0 ;test the carry flag
goto _40percent ;carry flag is SET if w is less than "test"

movwf test ;load the A/D value into the "test" file (2F)
movlw d'50' ;load decimal into w
subwf test,0 ;subtract d'' from test
btfss 03,0 ;test the carry flag
goto _50percent ;carry flag is SET if w is less than "test"

movwf test ;load the A/D value into the "test" file (2F)
movlw d'60' ;load decimal into w
subwf test,0 ;subtract d'' from test
btfss 03,0 ;test the carry flag
goto _60percent ;carry flag is SET if w is less than "test"

movwf test ;load the A/D value into the "test" file (2F)
movlw d'70' ;load decimal into w
subwf test,0 ;subtract d'' from test
btfss 03,0 ;test the carry flag
goto _70percent ;carry flag is SET if w is less than "test"

goto _80percent ;carry flag is SET if w is less than "test"

_00percent ;ALL LEDS OFF


bsf status, rp0 ;Bank 1
movlw b'11111111' ;Set all GP0 input
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00000000' ;no LEDs ON
movwf GPIO
retlw 00

_10percent
bsf status, rp0 ;Bank 1
movlw b'11011111' ;Set GP0 input GP5 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00100000' ;make GP 5 high
movwf GPIO
retlw 00

_20percent
bsf status, rp0 ;Bank 1
movlw b'11011111' ;Set GP0 input GP5 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00000000' ;make GP 5 low
movwf GPIO
retlw 00

_30percent
bsf status, rp0 ;Bank 1
movlw b'11101111' ;Set GP0 2 4 5 input GP4 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00010000' ;make GP 4 high
movwf GPIO
retlw 00

_40percent
bsf status, rp0 ;Bank 1
movlw b'11101111' ;Set GP0 2 5 input GP4 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00000000' ;make GP4 low
movwf GPIO
retlw 00

_50percent
bsf status, rp0 ;Bank 1
movlw b'11111011' ;Set GP0 2 5 input GP2 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00000100' ;make GP 2 high
movwf GPIO
retlw 00

_60percent
bsf status, rp0 ;Bank 1
movlw b'1111011' ;Set GP0 input GP2 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00000000' ;make GP 2 low
movwf GPIO
retlw 00

_70percent
bsf status, rp0 ;Bank 1
movlw b'1111101' ;Set GP0 input GP1 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00000010' ; make GP 1 high
movwf GPIO
retlw 00

_80percent
bsf status, rp0 ;Bank 1
movlw b'11111101' ;Set GP0 input GP1 as output
movwf TRISIO
bcf status, rp0 ;bank 0
movlw b'00000000' ;make GP 1 low
movwf GPIO
retlw 00

;*************************************
;* Main *
;*************************************

;Displays "Audio CRO"


;called "attract mode"

Main clrf shift ;moves display to the left by adding offset to


fetch
movlw .60
movwf loops ;number of loops before display starts to shift
call attract
decfsz loops,f
goto $-2

;shifts message across screen

incf shift,f
movlw .1 ; = decimal 1
movwf loops ;number of loops before display shifts
call attract
movlw d'49' ;number of shifts before exit
xorwf shift,w ;is shift = 49?
btfsc 03,2 ;test zero flag in status z=1 when same
goto $+4
decfsz loops,f
goto $-6
goto $-.10 ;= decimal 10

;stores 48 values in files 30h to 5Fh

Main1 bsf status, rp0 ;Bank 1


movlw b'11111111' ;Set GP3 input -look for inductor magnetism
movwf TRISIO
bcf status, rp0 ;bank 0
btfss gpio,3
goto $-1
movlw 30h ;first location for storing A_D value
movwf 04h ;put value into File Select Register
bsf ADCON0,1 ;Start A/D on GP0 (pin 7)
btfsc ADCON0,1 ;has conversion finished?
goto $-1
movf ADRESH,w ;put result of conversion into w
movwf 00h ;move value into INDF (actually 30h+)
incf 04h,f ;increment FSR to 31h etc
movlw 5Fh
xorwf 04h,w ;is file 04h = 5Fh
btfss 03,2 ;test zero flag in status z=1 when same
goto $-9 ;has loops reached file 5Fh? no

;displays 48 values on screen

movlw d'30'
movwf loops ;creates the 0.5sec refresh-time for viewing
display
bsf status, rp0 ;Bank 1
movlw b'11111111' ;Set GP3 input -look for inductor magnetism
movwf TRISIO
bcf status, rp0 ;bank 0
btfss gpio,3
goto $-1
movlw 30h ;first location for A_D value
movwf 04h ;put value into File Select Register
movf 00h,w ;move value from INDF (30h+) into w
call convert
call _250uS ;display for short time
call _00percent ;all LEDs off
nop ;gap between pixels
incf 04h,f ;increment FSR to 31h etc
movlw 5Fh
xorwf 04h,w ;is file 04h = 5Fh
btfss 03,2 ;test zero flag in status z=1 when same
goto $-9
decfsz loops,1 ;loops reached file 5Fh?
goto $-.19
goto Main1

;oscillator calibration

call 03ffh
movwf OSCCAL
end

MORE ON THE WEB


This project is much more complex than meets the eye. However we do not want to deter you and that's
why a pre-programmed chip is available with the kit.
There is a lot of detail available about using PIC chips, creating programs etc and these can be found on
the web by simply Googling PIC12F629 and/or PIC12F675.
The web is definitely the most incredible invention since "moveable type" and since it is the result of
millions of individual contributors, you will find an enormous amount of assistance at: "PIC Micro Webring." In
addition you will find information on "Talking Electronics Website." Click: "Fish Shop Timer" in the left index.

PROGRAMMING THE CHIP


The chip can be programmed using either Talking Electronics "Multi Chip Programmer" (approx $16.00)
and serial cable ($6.00) or PIC Programmer MkV (no kit for this project but its cost is less than $10.00) or
MicroChip PICkit-2 programmer (approx $65.00) plus 5/6 pin connector ($3.00) and a programming socket
(PCB programming board - $3.50) from Talking Electronics.
Here's the run-down.

USING MULTI CHIP PROGRAMMER or PIC Programmer MkV:


The 8-pin PIC chip is taken out of the socket on the project and fitted to the Multi Chip Programmer or
PIC Programmer MkV socket and "burnt." It is then put back into the project.
This is very easy to do.
You must have a serial port on your computer and most old-style computers (such as "desk-top" and
"towers" have a 9-pin serial port at the rear of the computer) for you to do this. The software to burn the chip
is IC-PROG. This is available from Talking Electronics website as well as MPASM, NotePad2 and .inc
files.
This gets you started with programming for less than $30.00.

USING PICkit-2:
If you don't have a serial port (such as for a laptop), you will need to buy the PICkit-2 programmer from
Microchip (from Modtronix in Australia) and use the USB port.
Most (all) lap-top computers have a USB port and this programmer comes with 2 disks containing all the
software you need.
This programmer is also very easy to use and works every time.
You will also need to assemble the 5/6 pin connector (from Talking Electronics - $3.50) that connects the
programmer to the project.

The PICkit-2 is available as a kit with a pre-programmed chip for the PICkit-2 PC board from:
http://www.auelectronics.com/Hardware-CB0703.htm for approx $34.99(USD) as BB0703 - Fully function
PICkit 2 System Part#:BB0703. But the 2CD's of software are not included.
The instructions for assembly can be found here:
http://augroups.blogspot.com/2009/02/step-by-step-assembly-guide-for-cb0703.html
but the cost of the kit is very nearly the same as the fully assembled kits from MicroChip:
http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164120 (cost $50.00 USD plus
postage or from Modtronix in Australia). The PICkit-2 from MicroChip is a "package" that also contains 2
CD's and an extra PC board that connects to the programmer so any 8, 14 and 20 pin micros can be
programmed. The board contains 4 LEDs, a push-button and a pot as well as some extra lands so you can
create a small project.

For Australian residents, PICkit-2 can be purchased from Modtronix for approx $50.00 USD plus postage
and this includes 2 CD's of software. But I am not sure if the extra board mentioned above is included in the
"package."
The 5/6 pin connector that connects the programmer to our project must be purchased from Talking
Electronics $3.50 - otherwise you will have to use the PC board (called an experimental board) that comes
with the "package" from Microchip, to hold the chip while it gets "burnt" (programmed).

20/5/2010

También podría gustarte