#include <16F628A.h>
//#device ADC=16
//#FUSES NOWDT //No Watch Dog Timer
//#FUSES NOBROWNOUT //No brownout reset
//#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
//#use delay(internal=4000000)
//#define LED PIN_A0
// #include <funciones.c>
// #include "funci.h"
//#include <16F628a.h>
#FUSES NOWDT
#FUSES NOMCLR
#FUSES NOBROWNOUT
#FUSES NOLVP
#FUSES PROTECT
#use delay(internal=4MHz)
//#use RS232 (baud = 9600, bits = 8, parity = N, xmit = pin_a0, rcv = pin_a1)
//#use rs232(baud=9600,parity=N,xmit=PIN_B2,rcv=PIN_B1,stream=RF1,errors)
#define NO_ANALOGS 0 // None
#define BDIR PIN_A7
#define BC1 PIN_A6
#byte porta= 0x05
#byte portb= 0x06
#byte trisa= 0x85
#byte trisb= 0x86
#include <funci.h>
#include <arreglos.c>
// const unsigned char tone_1[] = {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1c, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00};
// unsigned char tone_1[] = {0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xe0, 0x00, 0x01, 0x00, 0x00};
// unsigned char __musica[] = {0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xe0, 0x00, 0x01, 0x00, 0x00};
// protipos funciones
void set_mode_inactive();
void set_mode_latch();
void set_mode_write();
void write_register(char reg, char value);
void sound_play_tone(unsigned char tone);
//void sound_play_tone(unsigned char tone);
void main()
{
SET_TRIS_A(0B00100000);
SET_TRIS_B(0B00000000);
porta=0x00;
portb=0x00;
set_mode_inactive();
// Enable only the Tone Generator on Channel A
write_register(7, 0b00111110);
// Set the amplitude (volume) to maximum on Channel A
write_register(8, 0b00001111);
while(TRUE)
{
sound_play_tone(1);
DELAY_MS(500);
}
}