Skip to content

Instantly share code, notes, and snippets.

@simone-viozzi
Last active March 31, 2019 14:54
Show Gist options
  • Save simone-viozzi/fcae81799939d193cfcca1ac2ba81526 to your computer and use it in GitHub Desktop.
Save simone-viozzi/fcae81799939d193cfcca1ac2ba81526 to your computer and use it in GitHub Desktop.
///Dicharazione delle variabili///
#define I2C_ADDR 0x51 //setto l'indirizzo I2C del PIC 0x51
int var = 0;
char cont = 0;
unsigned short j;
char c_rit = 0;
char d1, d2, d3 = 0;
char ax = 0;
int tond;
void do1_t()
{
PORTB = 0x00;
asm{
salita_do1_t:
}
delay_ (119);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do1_t
goto salita_do1_t
fine_salita_do1_t:
movlw 0xFC
movwf PORTB, 1
discesa_do1_t:
}
delay_ (119);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do1_t
goto discesa_do1_t
fine_discesa_do1_t:
btfsc _ax, 0
goto salita_do1_t
clrf PORTB
}
}
void dodi1_t()
{
PORTB = 0x00;
asm{
salita_dodi1_t:
}
delay_ (112);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_dodi1_t
goto salita_dodi1_t
fine_salita_dodi1_t:
movlw 0xFC
movwf PORTB, 1
discesa_dodi1_t:
}
delay_ (112);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_dodi1_t
goto discesa_dodi1_t
fine_discesa_dodi1_t:
btfsc _ax, 0
goto salita_dodi1_t
clrf PORTB
}
}
void ren1_t()
{
PORTB = 0x00;
asm{
salita_ren1_t:
}
delay_ (106);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_ren1_t
goto salita_ren1_t
fine_salita_ren1_t:
movlw 0xFC
movwf PORTB, 1
discesa_ren1_t:
}
delay_ (106);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_ren1_t
goto discesa_ren1_t
fine_discesa_ren1_t:
btfsc _ax, 0
goto salita_ren1_t
clrf PORTB
}
}
void redi1_t()
{
PORTB = 0x00;
asm{
salita_redi1_t:
}
delay_ (100);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_redi1_t
goto salita_redi1_t
fine_salita_redi1_t:
movlw 0xFC
movwf PORTB, 1
discesa_redi1_t:
}
delay_ (100);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_redi1_t
goto discesa_redi1_t
fine_discesa_redi1_t:
btfsc _ax, 0
goto salita_redi1_t
clrf PORTB
}
}
void mi1_t()
{
PORTB = 0x00;
asm{
salita_mi1_t:
}
delay_ (94);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_mi1_t
goto salita_mi1_t
fine_salita_mi1_t:
movlw 0xFC
movwf PORTB, 1
discesa_mi1_t:
}
delay_ (94);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_mi1_t
goto discesa_mi1_t
fine_discesa_mi1_t:
btfsc _ax, 0
goto salita_mi1_t
clrf PORTB
}
}
void fa1_t()
{
PORTB = 0x00;
asm{
salita_fa1_t:
}
delay_ (89);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_fa1_t
goto salita_fa1_t
fine_salita_fa1_t:
movlw 0xFC
movwf PORTB, 1
discesa_fa1_t:
}
delay_ (89);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_fa1_t
goto discesa_fa1_t
fine_discesa_fa1_t:
btfsc _ax, 0
goto salita_fa1_t
clrf PORTB
}
}
void fadi1_t()
{
PORTB = 0x00;
asm{
salita_fadi1_t:
}
delay_ (84);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_fadi1_t
goto salita_fadi1_t
fine_salita_fadi1_t:
movlw 0xFC
movwf PORTB, 1
discesa_fadi1_t:
}
delay_ (84);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_fadi1_t
goto discesa_fadi1_t
fine_discesa_fadi1_t:
btfsc _ax, 0
goto salita_fadi1_t
clrf PORTB
}
}
void sol1_t()
{
PORTB = 0x00;
asm{
salita_sol1_t:
}
delay_ (79);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_sol1_t
goto salita_sol1_t
fine_salita_sol1_t:
movlw 0xFC
movwf PORTB, 1
discesa_sol1_t:
}
delay_ (79);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_sol1_t
goto discesa_sol1_t
fine_discesa_sol1_t:
btfsc _ax, 0
goto salita_sol1_t
clrf PORTB
}
}
void soldi1_t()
{
PORTB = 0x00;
asm{
salita_soldi1_t:
}
delay_ (74);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_soldi1_t
goto salita_soldi1_t
fine_salita_soldi1_t:
movlw 0xFC
movwf PORTB, 1
discesa_soldi1_t:
}
delay_ (74);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_soldi1_t
goto discesa_soldi1_t
fine_discesa_soldi1_t:
btfsc _ax, 0
goto salita_soldi1_t
clrf PORTB
}
}
void la1_t()
{
PORTB = 0x00;
asm{
salita_la1_t:
}
delay_ (70);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_la1_t
goto salita_la1_t
fine_salita_la1_t:
movlw 0xFC
movwf PORTB, 1
discesa_la1_t:
}
delay_ (70);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_la1_t
goto discesa_la1_t
fine_discesa_la1_t:
btfsc _ax, 0
goto salita_la1_t
clrf PORTB
}
}
void ladi1_t()
{
PORTB = 0x00;
asm{
salita_ladi1_t:
}
delay_ (66);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_ladi1_t
goto salita_ladi1_t
fine_salita_ladi1_t:
movlw 0xFC
movwf PORTB, 1
discesa_ladi1_t:
}
delay_ (66);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_ladi1_t
goto discesa_ladi1_t
fine_discesa_ladi1_t:
btfsc _ax, 0
goto salita_ladi1_t
clrf PORTB
}
}
void si1_t()
{
PORTB = 0x00;
asm{
salita_si1_t:
}
delay_ (62);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_si1_t
goto salita_si1_t
fine_salita_si1_t:
movlw 0xFC
movwf PORTB, 1
discesa_si1_t:
}
delay_ (62);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_si1_t
goto discesa_si1_t
fine_discesa_si1_t:
btfsc _ax, 0
goto salita_si1_t
clrf PORTB
}
}
void do2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (59);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (59);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void dodi2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (55);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (55);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ren2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (52);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (52);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void redi2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (49);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (49);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void mi2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (47);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (47);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fa2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (44);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (44);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fadi2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (41);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (41);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void sol2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (39);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (39);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void soldi2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (37);
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (37);
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void la2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (35);
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (35);
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ladi2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (33);
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (33);
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void si2_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (31);
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (31);
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void do3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (29);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (29);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void dodi3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (27);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (27);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ren3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (26);
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (26);
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void redi3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (24);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (24);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void mi3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (23);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (23);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fa3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (21);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (21);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fadi3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (20);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (20);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void sol3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (19);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (19);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void soldi3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (18);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (18);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void la3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (17);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (17);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ladi3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (16);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (16);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void si3_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (15);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (15);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void do4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (14);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (14);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void dodi4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (13);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (13);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ren4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
delay_ (12);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
delay_ (12);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void redi4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (12);
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (12);
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void mi4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (11);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (11);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fa4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (10);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (10);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fadi4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (10);
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (10);
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void sol4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (9);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (9);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void soldi4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (9);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (9);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void la4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (8);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (8);
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ladi4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (7);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (9);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void si4_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (7);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (7);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void do5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (7);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (7);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void dodi5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (6);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (6);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ren5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (6);
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (6);
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void redi5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (5);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (5);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void mi5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (5);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (5);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fa5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (5);
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (5);
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void fadi5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (4);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (4);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void sol5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (4);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (4);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void soldi5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (4);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (4);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void la5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (4);
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (4);
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void ladi5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (3);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (3);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void si5_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (3);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (3);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void do6_t()
{
PORTB = 0x00;
asm{
salita_do2_t:
}
Delay_ (3);
asm nop
asm nop
asm nop
asm{
movlw 0x04
addwf PORTB, 1
bz fine_salita_do2_t
goto salita_do2_t
fine_salita_do2_t:
movlw 0xFC
movwf PORTB, 1
discesa_do2_t:
}
Delay_ (3);
asm nop
asm nop
asm nop
asm{
movlw 0x04
subwf PORTB, 1
bz fine_discesa_do2_t
goto discesa_do2_t
fine_discesa_do2_t:
btfsc _ax, 0
goto salita_do2_t
clrf PORTB
}
}
void do1_q()
{
PORTB = 0x00;
asm inizio_do1_q:
asm comf PORTB, 1
Delay_us(3823);
asm btfsc _ax, 0
asm goto inizio_do1_q
}
void dodi1_q()
{
PORTB = 0x00;
asm inizio_dodi1_q:
asm comf PORTB, 1
Delay_us(3607);
asm btfsc _ax, 0
asm goto inizio_dodi1_q
}
void ren1_q()
{
PORTB = 0x00;
asm inizio_ren1_q:
asm comf PORTB, 1
Delay_us(3405);
asm btfsc _ax, 0
asm goto inizio_ren1_q
}
void redi1_q()
{
PORTB = 0x00;
asm inizio_redi1_q:
asm comf PORTB, 1
Delay_us(3214);
asm btfsc _ax, 0
asm goto inizio_redi1_q
}
void mi1_q()
{
PORTB = 0x00;
asm inizio_mi1_q:
asm comf PORTB, 1
Delay_us(3034);
asm btfsc _ax, 0
asm goto inizio_mi1_q
}
void fa1_q()
{
PORTB = 0x00;
asm inizio_fa1_q:
asm comf PORTB, 1
Delay_us(2864);
asm btfsc _ax, 0
asm goto inizio_fa1_q
}
void fadi1_q()
{
PORTB = 0x00;
asm inizio_fadi1_q:
asm comf PORTB, 1
Delay_us(2703);
asm btfsc _ax, 0
asm goto inizio_fadi1_q
}
void sol1_q()
{
PORTB = 0x00;
asm inizio_sol1_q:
asm comf PORTB, 1
Delay_us(2551);
asm btfsc _ax, 0
asm goto inizio_sol1_q
}
void soldi1_q()
{
PORTB = 0x00;
asm inizio_soldi1_q:
asm comf PORTB, 1
Delay_us(2408);
asm btfsc _ax, 0
asm goto inizio_soldi1_q
}
void la1_q()
{
PORTB = 0x00;
asm inizio_la1_q:
asm comf PORTB, 1
Delay_us(2272);
asm btfsc _ax, 0
asm goto inizio_la1_q
}
void ladi1_q()
{
PORTB = 0x00;
asm inizio_ladi1_q:
asm comf PORTB, 1
Delay_us(2145);
asm btfsc _ax, 0
asm goto inizio_ladi1_q
}
void si1_q()
{
PORTB = 0x00;
asm inizio_si1_q:
asm comf PORTB, 1
Delay_us(2024);
asm btfsc _ax, 0
asm goto inizio_si1_q
}
void do2_q()
{
PORTB = 0x00;
asm inizio_do2_q:
asm comf PORTB, 1
Delay_us(1911);
asm btfsc _ax, 0
asm goto inizio_do2_q
}
void dodi2_q()
{
PORTB = 0x00;
asm inizio_dodi2_q:
asm comf PORTB, 1
Delay_us(1804);
asm btfsc _ax, 0
asm goto inizio_dodi2_q
}
void ren2_q()
{
PORTB = 0x00;
asm inizio_ren2_q:
asm comf PORTB, 1
Delay_us(1703);
asm btfsc _ax, 0
asm goto inizio_ren2_q
}
void redi2_q()
{
PORTB = 0x00;
asm inizio_redi2_q:
asm comf PORTB, 1
Delay_us(1607);
asm btfsc _ax, 0
asm goto inizio_redi2_q
}
void mi2_q()
{
PORTB = 0x00;
asm inizio_mi2_q:
asm comf PORTB, 1
Delay_us(1517);
asm btfsc _ax, 0
asm goto inizio_mi2_q
}
void fa2_q()
{
PORTB = 0x00;
asm inizio_fa2_q:
asm comf PORTB, 1
Delay_us(1432);
asm btfsc _ax, 0
asm goto inizio_fa2_q
}
void fadi2_q()
{
PORTB = 0x00;
asm inizio_fadi2_q:
asm comf PORTB, 1
Delay_us(1351);
asm btfsc _ax, 0
asm goto inizio_fadi2_q
}
void sol2_q()
{
PORTB = 0x00;
asm inizio_sol2_q:
asm comf PORTB, 1
Delay_us(1275);
asm btfsc _ax, 0
asm goto inizio_sol2_q
}
void soldi2_q()
{
PORTB = 0x00;
asm inizio_soldi2_q:
asm comf PORTB, 1
Delay_us(1204);
asm btfsc _ax, 0
asm goto inizio_soldi2_q
}
void la2_q()
{
PORTB = 0x00;
asm inizio_la2_q:
asm comf PORTB, 1
Delay_us(1136);
asm btfsc _ax, 0
asm goto inizio_la2_q
}
void ladi2_q()
{
PORTB = 0x00;
asm inizio_ladi2_q:
asm comf PORTB, 1
Delay_us(1072);
asm btfsc _ax, 0
asm goto inizio_ladi2_q
}
void si2_q()
{
PORTB = 0x00;
asm inizio_si2_q:
asm comf PORTB, 1
Delay_us(1012);
asm btfsc _ax, 0
asm goto inizio_si2_q
}
void do3_q()
{
PORTB = 0x00;
asm inizio_do3_q:
asm comf PORTB, 1
Delay_us(955);
asm btfsc _ax, 0
asm goto inizio_do3_q
}
void dodi3_q()
{
PORTB = 0x00;
asm inizio_dodi3_q:
asm comf PORTB, 1
Delay_us(902);
asm btfsc _ax, 0
asm goto inizio_dodi3_q
}
void ren3_q()
{
PORTB = 0x00;
asm inizio_ren3_q:
asm comf PORTB, 1
Delay_us(851);
asm btfsc _ax, 0
asm goto inizio_ren3_q
}
void redi3_q()
{
PORTB = 0x00;
asm inizio_redi3_q:
asm comf PORTB, 1
Delay_us(803);
asm btfsc _ax, 0
asm goto inizio_redi3_q
}
void mi3_q()
{
PORTB = 0x00;
asm inizio_mi3_q:
asm comf PORTB, 1
Delay_us(758);
asm btfsc _ax, 0
asm goto inizio_mi3_q
}
void fa3_q()
{
PORTB = 0x00;
asm inizio_fa3_q:
asm comf PORTB, 1
Delay_us(716);
asm btfsc _ax, 0
asm goto inizio_fa3_q
}
void fadi3_q()
{
PORTB = 0x00;
asm inizio_fadi3_q:
asm comf PORTB, 1
Delay_us(676);
asm btfsc _ax, 0
asm goto inizio_fadi3_q
}
void sol3_q()
{
PORTB = 0x00;
asm inizio_sol3_q:
asm comf PORTB, 1
Delay_us(638);
asm btfsc _ax, 0
asm goto inizio_sol3_q
}
void soldi3_q()
{
PORTB = 0x00;
asm inizio_soldi3_q:
asm comf PORTB, 1
Delay_us(602);
asm btfsc _ax, 0
asm goto inizio_soldi3_q
}
void la3_q()
{
PORTB = 0x00;
asm inizio_la3_q:
asm comf PORTB, 1
Delay_us(568);
asm btfsc _ax, 0
asm goto inizio_la3_q
}
void ladi3_q()
{
PORTB = 0x00;
asm inizio_ladi3_q:
asm comf PORTB, 1
Delay_us(536);
asm btfsc _ax, 0
asm goto inizio_ladi3_q
}
void si3_q()
{
PORTB = 0x00;
asm inizio_si3_q:
asm comf PORTB, 1
Delay_us(506);
asm btfsc _ax, 0
asm goto inizio_si3_q
}
void do4_q()
{
PORTB = 0x00;
asm inizio_do4_q:
asm comf PORTB, 1
Delay_us(478);
asm btfsc _ax, 0
asm goto inizio_do4_q
}
void dodi4_q()
{
PORTB = 0x00;
asm inizio_dodi4_q:
asm comf PORTB, 1
Delay_us(451);
asm btfsc _ax, 0
asm goto inizio_dodi4_q
}
void ren4_q()
{
PORTB = 0x00;
asm inizio_ren4_q:
asm comf PORTB, 1
Delay_us(426);
asm btfsc _ax, 0
asm goto inizio_ren4_q
}
void redi4_q()
{
PORTB = 0x00;
asm inizio_redi4_q:
asm comf PORTB, 1
Delay_us(402);
asm btfsc _ax, 0
asm goto inizio_redi4_q
}
void mi4_q()
{
PORTB = 0x00;
asm inizio_mi4_q:
asm comf PORTB, 1
Delay_us(379);
asm btfsc _ax, 0
asm goto inizio_mi4_q
}
void fa4_q()
{
PORTB = 0x00;
asm inizio_fa4_q:
asm comf PORTB, 1
Delay_us(358);
asm btfsc _ax, 0
asm goto inizio_fa4_q
}
void fadi4_q()
{
PORTB = 0x00;
asm inizio_fadi4_q:
asm comf PORTB, 1
Delay_us(338);
asm btfsc _ax, 0
asm goto inizio_fadi4_q
}
void sol4_q()
{
PORTB = 0x00;
asm inizio_sol4_q:
asm comf PORTB, 1
Delay_us(319);
asm btfsc _ax, 0
asm goto inizio_sol4_q
}
void soldi4_q()
{
PORTB = 0x00;
asm inizio_soldi4_q:
asm comf PORTB, 1
Delay_us(301);
asm btfsc _ax, 0
asm goto inizio_soldi4_q
}
void la4_q()
{
PORTB = 0x00;
asm inizio_la4_q:
asm comf PORTB, 1
Delay_us(284);
asm btfsc _ax, 0
asm goto inizio_la4_q
}
void ladi4_q()
{
PORTB = 0x00;
asm inizio_ladi4_q:
asm comf PORTB, 1
Delay_us(268);
asm btfsc _ax, 0
asm goto inizio_ladi4_q
}
void si4_q()
{
PORTB = 0x00;
asm inizio_si4_q:
asm comf PORTB, 1
Delay_us(253);
asm btfsc _ax, 0
asm goto inizio_si4_q
}
void do5_q()
{
PORTB = 0x00;
asm inizio_do5_q:
asm comf PORTB, 1
Delay_us(239);
asm btfsc _ax, 0
asm goto inizio_do5_q
}
void dodi5_q()
{
PORTB = 0x00;
asm inizio_dodi5_q:
asm comf PORTB, 1
Delay_us(225);
asm btfsc _ax, 0
asm goto inizio_dodi5_q
}
void ren5_q()
{
PORTB = 0x00;
asm inizio_ren5_q:
asm comf PORTB, 1
Delay_us(213);
asm btfsc _ax, 0
asm goto inizio_ren5_q
}
void redi5_q()
{
PORTB = 0x00;
asm inizio_redi5_q:
asm comf PORTB, 1
Delay_us(201);
asm btfsc _ax, 0
asm goto inizio_redi5_q
}
void mi5_q()
{
PORTB = 0x00;
asm inizio_mi5_q:
asm comf PORTB, 1
Delay_us(190);
asm btfsc _ax, 0
asm goto inizio_mi5_q
}
void fa5_q()
{
PORTB = 0x00;
asm inizio_fa5_q:
asm comf PORTB, 1
Delay_us(179);
asm btfsc _ax, 0
asm goto inizio_fa5_q
}
void fadi5_q()
{
PORTB = 0x00;
asm inizio_fadi5_q:
asm comf PORTB, 1
Delay_us(169);
asm btfsc _ax, 0
asm goto inizio_fadi5_q
}
void sol5_q()
{
PORTB = 0x00;
asm inizio_sol5_q:
asm comf PORTB, 1
Delay_us(159);
asm btfsc _ax, 0
asm goto inizio_sol5_q
}
void soldi5_q()
{
PORTB = 0x00;
asm inizio_soldi5_q:
asm comf PORTB, 1
Delay_us(150);
asm btfsc _ax, 0
asm goto inizio_soldi5_q
}
void la5_q()
{
PORTB = 0x00;
asm inizio_la5_q:
asm comf PORTB, 1
Delay_us(142);
asm btfsc _ax, 0
asm goto inizio_la5_q
}
void ladi5_q()
{
PORTB = 0x00;
asm inizio_ladi5_q:
asm comf PORTB, 1
Delay_us(134);
asm btfsc _ax, 0
asm goto inizio_ladi5_q
}
void si5_q()
{
PORTB = 0x00;
asm inizio_si5_q:
asm comf PORTB, 1
Delay_us(126);
asm btfsc _ax, 0
asm goto inizio_si5_q
}
void do6_q()
{
PORTB = 0x00;
asm inizio_do6_q:
asm comf PORTB, 1
Delay_us(119);
asm btfsc _ax, 0
asm goto inizio_do6_q
}
void do1_s()
{
asm{
inizio_do1_s:
incf PORTB, 1
}
delay_ (29);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_do1_s
clrf PORTB
}
}
void dodi1_s()
{
asm{
inizio_dodi1_s:
incf PORTB, 1
}
delay_ (27);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_dodi1_s
clrf PORTB
}
}
void ren1_s()
{
asm{
inizio_ren1_s:
incf PORTB, 1
}
delay_ (26);
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_ren1_s
clrf PORTB
}
}
void redi1_s()
{
asm{
inizio_redi1_s:
incf PORTB, 1
}
delay_ (24);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_redi1_s
clrf PORTB
}
}
void mi1_s()
{
asm{
inizio_mi1_s:
incf PORTB, 1
}
delay_ (23);
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_mi1_s
clrf PORTB
}
}
void fa1_s()
{
asm{
inizio_fa1_s:
incf PORTB, 1
}
delay_ (22);
asm{
btfsc _ax, 0
goto inizio_fa1_s
clrf PORTB
}
}
void fadi1_s()
{
asm{
inizio_fadi1_s:
incf PORTB, 1
}
delay_ (20);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fadi1_s
clrf PORTB
}
}
void sol1_s()
{
asm{
inizio_sol1_s:
incf PORTB, 1
}
delay_ (19);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_sol1_s
clrf PORTB
}
}
void soldi1_s()
{
asm{
inizio_soldi1_s:
incf PORTB, 1
}
delay_ (18);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_soldi1_s
clrf PORTB
}
}
void la1_s()
{
asm{
inizio_la1_s:
incf PORTB, 1
}
delay_ (17);
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_la1_s
clrf PORTB
}
}
void ladi1_s()
{
asm{
inizio_ladi1_s:
incf PORTB, 1
}
delay_ (16);
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_ladi1_s
clrf PORTB
}
}
void si1_s()
{
asm{
inizio_si1_s:
incf PORTB, 1
}
delay_ (15);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_si1_s
clrf PORTB
}
}
void do2_s()
{
asm{
inizio_do2_s:
incf PORTB, 1
}
delay_ (14);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_do2_s
clrf PORTB
}
}
void dodi2_s()
{
asm{
inizio_dodi2_s:
incf PORTB, 1
}
delay_ (13);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_dodi2_s
clrf PORTB
}
}
void ren2_s()
{
asm{
inizio_ren2_s:
incf PORTB, 1
}
delay_ (13);
asm{
btfsc _ax, 0
goto inizio_ren2_s
clrf PORTB
}
}
void redi2_s()
{
asm{
inizio_redi2_s:
incf PORTB, 1
}
delay_ (12);
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_redi2_s
clrf PORTB
}
}
void mi2_s()
{
asm{
inizio_mi2_s:
incf PORTB, 1
}
delay_ (11);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_mi2_s
clrf PORTB
}
}
void fa2_s()
{
asm{
inizio_fa2_s:
incf PORTB, 1
}
delay_ (10);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fa2_s
clrf PORTB
}
}
void fadi2_s()
{
asm{
inizio_fadi2_s:
incf PORTB, 1
}
delay_ (10);
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fadi2_s
clrf PORTB
}
}
void sol2_s()
{
asm{
inizio_sol2_s:
incf PORTB, 1
}
delay_ (9);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_sol2_s
clrf PORTB
}
}
void soldi2_s()
{
asm{
inizio_soldi2_s:
incf PORTB, 1
}
delay_ (9);
asm nop
asm{
btfsc _ax, 0
goto inizio_soldi2_s
clrf PORTB
}
}
void la2_s()
{
asm{
inizio_la2_s:
incf PORTB, 1
}
delay_ (8);
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_la2_s
clrf PORTB
}
}
void ladi2_s()
{
asm{
inizio_ladi2_s:
incf PORTB, 1
}
delay_ (8);
asm{
btfsc _ax, 0
goto inizio_ladi2_s
clrf PORTB
}
}
void si2_s()
{
asm{
inizio_si2_s:
incf PORTB, 1
}
delay_ (7);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_si2_s
clrf PORTB
}
}
void do3_s()
{
asm{
inizio_do3_s:
incf PORTB, 1
}
delay_ (7);
asm nop
asm{
btfsc _ax, 0
goto inizio_do3_s
clrf PORTB
}
}
void dodi3_s()
{
asm{
inizio_dodi3_s:
incf PORTB, 1
}
delay_ (6);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_dodi3_s
clrf PORTB
}
}
void ren3_s()
{
asm{
inizio_ren3_s:
incf PORTB, 1
}
delay_ (6);
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_ren3_s
clrf PORTB
}
}
void redi3_s()
{
asm{
inizio_redi3_s:
incf PORTB, 1
}
delay_ (5);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_redi3_s
clrf PORTB
}
}
void mi3_s()
{
asm{
inizio_mi3_s:
incf PORTB, 1
}
delay_ (5);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_mi3_s
clrf PORTB
}
}
void fa3_s()
{
asm{
inizio_fa3_s:
incf PORTB, 1
}
delay_ (5);
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fa3_s
clrf PORTB
}
}
void fadi3_s()
{
asm{
inizio_fadi3_s:
incf PORTB, 1
}
delay_ (4);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fadi3_s
clrf PORTB
}
}
void sol3_s()
{
asm{
inizio_sol3_s:
incf PORTB, 1
}
delay_ (4);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_sol3_s
clrf PORTB
}
}
void soldi3_s()
{
asm{
inizio_soldi3_s:
incf PORTB, 1
}
delay_ (4);
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_soldi3_s
clrf PORTB
}
}
void la3_s()
{
asm{
inizio_la3_s:
incf PORTB, 1
}
delay_ (4);
asm nop
asm{
btfsc _ax, 0
goto inizio_la3_s
clrf PORTB
}
}
void ladi3_s()
{
asm{
inizio_ladi3_s:
incf PORTB, 1
}
delay_ (3);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_ladi3_s
clrf PORTB
}
}
void si3_s()
{
asm{
inizio_si3_s:
incf PORTB, 1
}
delay_ (3);
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_si3_s
clrf PORTB
}
}
void do4_s()
{
asm{
inizio_do4_s:
incf PORTB, 1
}
delay_ (3);
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_do4_s
clrf PORTB
}
}
void dodi4_s()
{
asm{
inizio_dodi4_s:
incf PORTB, 1
}
delay_ (3);
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_dodi4_s
clrf PORTB
}
}
void ren4_s()
{
asm{
inizio_ren4_s:
incf PORTB, 1
}
delay_ (3);
asm{
btfsc _ax, 0
goto inizio_ren4_s
clrf PORTB
}
}
void redi4_s()
{
asm{
inizio_redi4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_redi4_s
clrf PORTB
}
}
void mi4_s()
{
asm{
inizio_mi4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_mi4_s
clrf PORTB
}
}
void fa4_s()
{
asm{
inizio_fa4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fa4_s
clrf PORTB
}
}
void fadi4_s()
{
asm{
inizio_fadi4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fadi4_s
clrf PORTB
}
}
void sol4_s()
{
asm{
inizio_sol4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_sol4_s
clrf PORTB
}
}
void soldi4_s()
{
asm{
inizio_soldi4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_soldi4_s
clrf PORTB
}
}
void la4_s()
{
asm{
inizio_la4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_la4_s
clrf PORTB
}
}
void ladi4_s()
{
asm{
inizio_ladi4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_ladi4_s
clrf PORTB
}
}
void si4_s()
{
asm{
inizio_si4_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_si4_s
clrf PORTB
}
}
void do5_s()
{
asm{
inizio_do5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_do5_s
clrf PORTB
}
}
void dodi5_s()
{
asm{
inizio_dodi5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_dodi5_s
clrf PORTB
}
}
void ren5_s()
{
asm{
inizio_ren5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_ren5_s
clrf PORTB
}
}
void redi5_s()
{
asm{
inizio_redi5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_redi5_s
clrf PORTB
}
}
void mi5_s()
{
asm{
inizio_mi5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_mi5_s
clrf PORTB
}
}
void fa5_s()
{
asm{
inizio_fa5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fa5_s
clrf PORTB
}
}
void fadi5_s()
{
asm{
inizio_fadi5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_fadi5_s
clrf PORTB
}
}
void sol5_s()
{
asm{
inizio_sol5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_sol5_s
clrf PORTB
}
}
void soldi5_s()
{
asm{
inizio_soldi5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_soldi5_s
clrf PORTB
}
}
void la5_s()
{
asm{
inizio_la5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_la5_s
clrf PORTB
}
}
void ladi5_s()
{
asm{
inizio_ladi5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_ladi5_s
clrf PORTB
}
}
void si5_s()
{
asm{
inizio_si5_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_si5_s
clrf PORTB
}
}
void do6_s()
{
asm{
inizio_do6_s:
incf PORTB, 1
}
asm nop
asm nop
asm nop
asm nop
asm nop
asm nop
asm{
btfsc _ax, 0
goto inizio_do6_s
clrf PORTB
}
}
void interrupt()
{
// I2C slave interrupt handler
if (PIR1.SSPIF == 1)
{ // I2C Interrupt
PIR1.SSPIF = 0; // reset SSP interrupt flag
//transmit data to master
if (SSPSTAT.R_W == 1)
{ // Read request from master
SSPBUF = 0xAA; // Get data to send
SSPCON1.CKP = 1; // Release SCL line
j = SSPBUF; // That's it
return;
}
if (SSPSTAT.BF == 0)
{ // all done,
j = SSPBUF; // Nothing in buffer so exit
return;
}
//recieve data from master
if (SSPSTAT.D_A == 1)
{ // Data [not address]
var = SSPBUF; // get data
ax=0;
j = SSPBUF; // read buffer to clear flag [address]
return;
}
}
j = SSPBUF; // read buffer to clear flag [address]
}
void main(void)
{
TRISB = 0x00; //uscita suono
TRISC = 0xFF; //ingresso I2C
TRISD = 0x00; //porta di test
PORTD = 0x00;
PORTB = 0x00;
SSPCON1 = 0b00110110; /*I2C slave (SSP abilitato dal bit 5, clock abilitato dal bit 4,
slave, indirizzo a 7 bit, no interruzioni sullo start o stop nei bit 3,2,1,0.)*/
SSPADD = I2C_ADDR << 1; //setto l'indirizzo dell'I2C
SSPSTAT = 0x00; //resetto il registro sspstat
PIE1.SSPIE = 1; //abilita l'interruzione sul registro ssp
PIR1.SSPIF = 0; //resetta il flag dell'interruzione sul registro ssp
INTCON.PEIE = 1; //abilita l'interruzione
INTCON.GIE = 1; //abilita l'interruzione generale
CMCON.B0 = 1; /////disattivo i comparatori sulla porta d
CMCON.B1 = 1;
CMCON.B2 = 1; ///////
INTCON2.B7 = 1;///disattivo il pull up sulla porta b ù
delay_ms(10);
while (1)
{
if (var != 0)
{
if (var == 0b10110011) //onda quadra
{
tond = 6;
PORTD.B0 = 1;
PORTD.B1 = 0;
PORTD.B2 = 0;
}
else if (var == 0b10110010) //onda sega
{
tond = 4;
PORTD.B0 = 0;
PORTD.B1 = 1;
PORTD.B2 = 0;
}
else if (var == 0b10110001) //onda triangolare
{
tond = 5;
PORTD.B0 = 0;
PORTD.B1 = 0;
PORTD.B2 = 1;
}
if (tond == 4) //onda quadra
{
if (var == 4)
{
ax = 1;
do1_q();
}
else if (var == 5)
{
ax = 1;
dodi1_q();
}
else if (var == 6)
{
ax = 1;
ren1_q();
}
else if (var == 7)
{
ax = 1;
redi1_q();
}
else if (var == 8)
{
ax = 1;
mi1_q();
}
else if (var == 9)
{
ax = 1;
fa1_q();
}
else if (var == 10)
{
ax = 1;
fadi1_q();
}
else if (var == 11)
{
ax = 1;
sol1_q();
}
else if (var == 12)
{
ax = 1;
soldi1_q();
}
else if (var == 13)
{
ax = 1;
la1_q();
}
else if (var == 14)
{
ax = 1;
ladi1_q();
}
else if (var==15)
{
ax = 1;
si1_q();
}
else if (var == 16)
{
ax = 1;
do2_q();
}
else if (var == 17)
{
ax = 1;
dodi2_q();
}
else if (var == 18)
{
ax = 1;
ren2_q();
}
else if (var == 19)
{
ax = 1;
redi2_q();
}
else if (var == 20)
{
ax = 1;
mi2_q();
}
else if (var == 21)
{
ax = 1;
fa2_q();
}
else if (var == 22)
{
ax = 1;
fadi2_q();
}
else if (var == 23)
{
ax = 1;
sol2_q();
}
else if (var == 24)
{
ax = 1;
soldi2_q();
}
else if (var == 25)
{
ax = 1;
la2_q();
}
else if (var == 26)
{
ax = 1;
ladi2_q();
}
else if (var==27)
{
ax = 1;
si2_q();
}
else if (var == 28)
{
ax = 1;
do3_q();
}
else if (var == 29)
{
ax = 1;
dodi3_q();
}
else if (var == 30)
{
ax = 1;
ren3_q();
}
else if (var == 31)
{
ax = 1;
redi3_q();
}
else if (var == 32)
{
ax = 1;
mi3_q();
}
else if (var == 33)
{
ax = 1;
fa3_q();
}
else if (var == 34)
{
ax = 1;
fadi3_q();
}
else if (var == 35)
{
ax = 1;
sol3_q();
}
else if (var == 36)
{
ax = 1;
soldi3_q();
}
else if (var == 37)
{
ax = 1;
la3_q();
}
else if (var == 38)
{
ax = 1;
ladi3_q();
}
else if (var==39)
{
ax = 1;
si3_q();
}
else if (var == 40)
{
ax = 1;
do4_q();
}
else if (var == 41)
{
ax = 1;
dodi4_q();
}
else if (var == 42)
{
ax = 1;
ren4_q();
}
else if (var == 43)
{
ax = 1;
redi4_q();
}
else if (var == 44)
{
ax = 1;
mi4_q();
}
else if (var == 45)
{
ax = 1;
fa4_q();
}
else if (var == 46)
{
ax = 1;
fadi4_q();
}
else if (var == 47)
{
ax = 1;
sol4_q();
}
else if (var == 48)
{
ax = 1;
soldi4_q();
}
else if (var == 49)
{
ax = 1;
la4_q();
}
else if (var == 50)
{
ax = 1;
ladi4_q();
}
else if (var==51)
{
ax = 1;
si4_q();
}
else if (var == 52)
{
ax = 1;
do5_q();
}
else if (var == 53)
{
ax = 1;
dodi5_q();
}
else if (var == 54)
{
ax = 1;
ren5_q();
}
else if (var == 55)
{
ax = 1;
redi5_q();
}
else if (var == 56)
{
ax = 1;
mi5_q();
}
else if (var == 57)
{
ax = 1;
fa5_q();
}
else if (var == 58)
{
ax = 1;
fadi5_q();
}
else if (var == 59)
{
ax = 1;
sol5_q();
}
else if (var == 60)
{
ax = 1;
soldi5_q();
}
else if (var == 61)
{
ax = 1;
la5_q();
}
else if (var == 62)
{
ax = 1;
ladi5_q();
}
else if (var==63)
{
ax = 1;
si5_q();
}
else if (var==64)
{
ax = 1;
do6_q();
}
}
else if (tond == 5) //onda sega
{
if (var == 4)
{
ax = 1;
do1_s();
}
else if (var == 5)
{
ax = 1;
dodi1_s();
}
else if (var == 6)
{
ax = 1;
ren1_s();
}
else if (var == 7)
{
ax = 1;
redi1_s();
}
else if (var == 8)
{
ax = 1;
mi1_s();
}
else if (var == 9)
{
ax = 1;
fa1_s();
}
else if (var == 10)
{
ax = 1;
fadi1_s();
}
else if (var == 11)
{
ax = 1;
sol1_s();
}
else if (var == 12)
{
ax = 1;
soldi1_s();
}
else if (var == 13)
{
ax = 1;
la1_s();
}
else if (var == 14)
{
ax = 1;
ladi1_s();
}
else if (var==15)
{
ax = 1;
si1_s();
}
else if (var == 16)
{
ax = 1;
do2_s();
}
else if (var == 17)
{
ax = 1;
dodi2_s();
}
else if (var == 18)
{
ax = 1;
ren2_s();
}
else if (var == 19)
{
ax = 1;
redi2_s();
}
else if (var == 20)
{
ax = 1;
mi2_s();
}
else if (var == 21)
{
ax = 1;
fa2_s();
}
else if (var == 22)
{
ax = 1;
fadi2_s();
}
else if (var == 23)
{
ax = 1;
sol2_s();
}
else if (var == 24)
{
ax = 1;
soldi2_s();
}
else if (var == 25)
{
ax = 1;
la2_s();
}
else if (var == 26)
{
ax = 1;
ladi2_s();
}
else if (var==27)
{
ax = 1;
si2_s();
}
else if (var == 28)
{
ax = 1;
do3_s();
}
else if (var == 29)
{
ax = 1;
dodi3_s();
}
else if (var == 30)
{
ax = 1;
ren3_s();
}
else if (var == 31)
{
ax = 1;
redi3_s();
}
else if (var == 32)
{
ax = 1;
mi3_s();
}
else if (var == 33)
{
ax = 1;
fa3_s();
}
else if (var == 34)
{
ax = 1;
fadi3_s();
}
else if (var == 35)
{
ax = 1;
sol3_s();
}
else if (var == 36)
{
ax = 1;
soldi3_s();
}
else if (var == 37)
{
ax = 1;
la3_s();
}
else if (var == 38)
{
ax = 1;
ladi3_s();
}
else if (var==39)
{
ax = 1;
si3_s();
}
else if (var == 40)
{
ax = 1;
do4_s();
}
else if (var == 41)
{
ax = 1;
dodi4_s();
}
else if (var == 42)
{
ax = 1;
ren4_s();
}
else if (var == 43)
{
ax = 1;
redi4_s();
}
else if (var == 44)
{
ax = 1;
mi4_s();
}
else if (var == 45)
{
ax = 1;
fa4_s();
}
else if (var == 46)
{
ax = 1;
fadi4_s();
}
else if (var == 47)
{
ax = 1;
sol4_s();
}
else if (var == 48)
{
ax = 1;
soldi4_s();
}
else if (var == 49)
{
ax = 1;
la4_s();
}
else if (var == 50)
{
ax = 1;
ladi4_s();
}
else if (var==51)
{
ax = 1;
si4_s();
}
else if (var == 52)
{
ax = 1;
do5_s();
}
else if (var == 53)
{
ax = 1;
dodi5_s();
}
else if (var == 54)
{
ax = 1;
ren5_s();
}
else if (var == 55)
{
ax = 1;
redi5_s();
}
else if (var == 56)
{
ax = 1;
mi5_s();
}
else if (var == 57)
{
ax = 1;
fa5_s();
}
else if (var == 58)
{
ax = 1;
fadi5_s();
}
else if (var == 59)
{
ax = 1;
sol5_s();
}
else if (var == 60)
{
ax = 1;
soldi5_s();
}
else if (var == 61)
{
ax = 1;
la5_s();
}
else if (var == 62)
{
ax = 1;
ladi5_s();
}
else if (var==63)
{
ax = 1;
si5_s();
}
else if (var==64)
{
ax = 1;
do6_s();
}
}
else if (tond == 6) //onda triangolare
{
if (var == 4)
{
ax = 1;
do1_t();
}
else if (var == 5)
{
ax = 1;
dodi1_t();
}
else if (var == 6)
{
ax = 1;
ren1_t();
}
else if (var == 7)
{
ax = 1;
redi1_t();
}
else if (var == 8)
{
ax = 1;
mi1_t();
}
else if (var == 9)
{
ax = 1;
fa1_t();
}
else if (var == 10)
{
ax = 1;
fadi1_t();
}
else if (var == 11)
{
ax = 1;
sol1_t();
}
else if (var == 12)
{
ax = 1;
soldi1_t();
}
else if (var == 13)
{
ax = 1;
la1_t();
}
else if (var == 14)
{
ax = 1;
ladi1_t();
}
else if (var==15)
{
ax = 1;
si1_t();
}
else if (var == 16)
{
ax = 1;
do2_t();
}
else if (var == 17)
{
ax = 1;
dodi2_t();
}
else if (var == 18)
{
ax = 1;
ren2_t();
}
else if (var == 19)
{
ax = 1;
redi2_t();
}
else if (var == 20)
{
ax = 1;
mi2_t();
}
else if (var == 21)
{
ax = 1;
fa2_t();
}
else if (var == 22)
{
ax = 1;
fadi2_t();
}
else if (var == 23)
{
ax = 1;
sol2_t();
}
else if (var == 24)
{
ax = 1;
soldi2_t();
}
else if (var == 25)
{
ax = 1;
la2_t();
}
else if (var == 26)
{
ax = 1;
ladi2_t();
}
else if (var==27)
{
ax = 1;
si2_t();
}
else if (var == 28)
{
ax = 1;
do3_t();
}
else if (var == 29)
{
ax = 1;
dodi3_t();
}
else if (var == 30)
{
ax = 1;
ren3_t();
}
else if (var == 31)
{
ax = 1;
redi3_t();
}
else if (var == 32)
{
ax = 1;
mi3_t();
}
else if (var == 33)
{
ax = 1;
fa3_t();
}
else if (var == 34)
{
ax = 1;
fadi3_t();
}
else if (var == 35)
{
ax = 1;
sol3_t();
}
else if (var == 36)
{
ax = 1;
soldi3_t();
}
else if (var == 37)
{
ax = 1;
la3_t();
}
else if (var == 38)
{
ax = 1;
ladi3_t();
}
else if (var==39)
{
ax = 1;
si3_t();
}
else if (var == 40)
{
ax = 1;
do4_t();
}
else if (var == 41)
{
ax = 1;
dodi4_t();
}
else if (var == 42)
{
ax = 1;
ren4_t();
}
else if (var == 43)
{
ax = 1;
redi4_t();
}
else if (var == 44)
{
ax = 1;
mi4_t();
}
else if (var == 45)
{
ax = 1;
fa4_t();
}
else if (var == 46)
{
ax = 1;
fadi4_t();
}
else if (var == 47)
{
ax = 1;
sol4_t();
}
else if (var == 48)
{
ax = 1;
soldi4_t();
}
else if (var == 49)
{
ax = 1;
la4_t();
}
else if (var == 50)
{
ax = 1;
ladi4_t();
}
else if (var==51)
{
ax = 1;
si4_t();
}
else if (var == 52)
{
ax = 1;
do5_t();
}
else if (var == 53)
{
ax = 1;
dodi5_t();
}
else if (var == 54)
{
ax = 1;
ren5_t();
}
else if (var == 55)
{
ax = 1;
redi5_t();
}
else if (var == 56)
{
ax = 1;
mi5_t();
}
else if (var == 57)
{
ax = 1;
fa5_t();
}
else if (var == 58)
{
ax = 1;
fadi5_t();
}
else if (var == 59)
{
ax = 1;
sol5_t();
}
else if (var == 60)
{
ax = 1;
soldi5_t();
}
else if (var == 61)
{
ax = 1;
la5_t();
}
else if (var == 62)
{
ax = 1;
ladi5_t();
}
else if (var==63)
{
ax = 1;
si5_t();
}
else if (var==64)
{
ax = 1;
do6_t();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment