Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with code for polyphonic doorbell

Status
Not open for further replies.

iwanizati

Newbie level 1
Joined
Feb 16, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,322
i dont understand with this assembler..hope you can help me...
and this assembler for polyphonic dorbell and have 4 file..when i compile this file,have many error..


#include def84.asm
#include macro84.asm

error level 2
org 0x0C ;start of RAM
masque res 1
masque1 res 1
compteur0 res 1
compteur1 res 1
compteur3 res 1
note0 res 1
note1 res 1
note2 res 1
note3 res 1
play0 res 1
play1 res 1
play2 res 1
play3 res 1

accident res 1
duree res 1
vitesse res 1
c1 res 1
ptrmorceaul res 1
ptrmorceauh res 1
num_morceau res 1
num0 res 1

;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

#define fa0d .0 ;notes
#define s0l0 .1
#define la0 .2
#define si0b .3
#define si0 .4
#define do0 .5
#define do0d .6
#define re0 .7
#define mi0 .8
#define fa1 .9
#define fa1d .10
#define sol1 .11
#define la1 .12
#define si1b .13
#define si1 .14
#define do1 .15

#define tcr .0 ;duration
#define dcr .1
#define cr .3
#define crp .5
#define n .7
#define np .11
#define b .15
#define bp .23
#define r .31
#define fin .1 ;event
#define tempo .2
#define power porta,0x03

;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

org 0x0
Go_to_ Main
org 0x04
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin_
bcf intcon,toif
Move vitesse,timer
movlw 0xF0
bsf status,rp0 ;begin of charge capacitor program
iorwf trisb
bcf status,rp0
Dec duree
If_zero then
Begin_
_ Morceau
Endif_
retfie

;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Begin_
Movei 0xFF,masquel ;prepara the capacitor mask
movlw 0x0F
_ Morceau 0
Move wreg,accident ;get duration and pitch
Move wreg,duree
swapf accident
rrf accident
Andi accident,0x07
Andi duree,0x1F
Inc duree ;1 to 32
bcf carry
rlf duree
bcf carry
rlf duree

If_eqi accident,fin then ;the end:power off
bcf power
la
goto la
Endif_
If_eqi accident,tempo then
Move duree,vitesse
Addi 0x03,ptrmorceaul
If_carry
Inc ptrmorceaul
Endif_
Go_to_ Morceau
Endif_

Inc ptrmorceaul ;get number of notes to interpret PLAY0...PlAY3
If_ zero
Inc ptrmorceaul
Endif_

_ Morceau0
Move wreg,play0
Move wreg,play1
swapf play0
Andi play0,0x0F
Andi play1,0x0F

Inc ptrmorceaul
If_ zero
Inc ptrmorceauh
Endif_
_ Morceau0
Move wreg,play2
Move wreg,play3
swapf play2
Andi play2,0x0F
Andi play3,0x0F

Inc ptrmorceaul
If_ zero
Inc ptrmorceauh
Endif_

Movei high Tabnote,pch ;get value for charging capacitors
Move play0,wreg
If_not zero then
_ Tabnote
Move wreg,note1
bcf masque1,0x6 ;capacitor 0
Endif_

Move high Tabnote,pch
Move play1,wreg
If_not zero then
_ Tabnote
Move wreg,note1
bcf masquel,0x6 ;capacitor 1
Endif_

Movei high Tabnote,pch
Move play2,wreg
If_not zero then
_ Tabnote
Move wreg,note2
bcf masque1,0x5 ;capacitor 2
Endif_

Movei high Tabnote,pch
Move play3,wreg
If_not zero then
_ Tabnote
Move wreg,note3
bcf masque1,0x4 ;capacitor 3
Endif_

Move masque1,wreg
bsf status,rp0
And trisb,wreg
bcf status,rp0
End_

;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Begin_
Movei 0xF0,portb
Movei 0x00,porta
bsf power
bsf status,rp0 ;page 1 >0x80
Movei 0x0,trisa
Movei 0xFF,trisb ;port B as input

Clr intcon ;clear interrupts
Clr roption
bcf roption,psa ;timer divisor = max
bsf roption,ps0
bsf roption,ps1
bsf roption,ps2
bcf roption,t0cs ;timer 0 clock source=clock Q/4
bsf roption,rbpu
bcf status,rp0

Movei 0x00,eeadr
_ Read
Move wreg,num0
Movei 0x01,eeadr
_ Read
xorwf num0,wreg
addlw 0x01
If_not zero then ;Error:rewrite songnumber
Begin_
Clr eeadr
Clr eedata
_ Write
Movei 0x01,eeadr
Movei 0xFF,eedata
_ Write
Else
Inc num0
If_eqi num0.0x08
Clr num0
Endif_
Move num0,eedata
Clr eaadr
_ Write
comf num0,wreg
Move wreg,eedata
Inc eeadr
_ Write
Endif_

Movei high Tabmorceau,pch ;search for start of song to play
bcf carry
rlf num0,wreg
_ Tabmorceau
Move wreg,ptrmorceauh
Movei high Tabmorceau,pch
rlf num0,wreg
addlw 0x01
_ Tabmorceau
Move wreg,ptrmorceaul
bsf intcon,toie
Clr c1
Movei .1,duree
Movei 0xFF,timer
End_

;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Begin_
debut
bsf intcon,gie
clrf masque
bcf intcon,gie

Decf compteur0
btfsc zero
goto a0
b0
Dec compteur1
btfsc zero
goto a1
b1
Dec compteur2
btfsc zero
goto a2
b3
Move masque,wreg
Bset banque1
Xor trisb,wreg
Bclr banque1
goto debut

a0
Move note0,compteur0
bsf masque,0x00
goto b0

a1
Move note1,compteur1
bsf masque,0x01
goto b1
a2
Move note2,compteur2
bsf masque,0x02
goto b2
a3
Move note3,compteur2
bsf masque,0x03
goto b3
End_

;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Begin_
_Init;
_Play;
End_

#include morceau.asm

End_
 

Re: PIC 16F84A

Try harder!

No one will study the whole project for you. Ask after trying your best.

Cheers,
 

PIC 16F84A

also post the errors, it helps a lot to figure out the problem, going through the asm code is rather tedious job.
 

Re: PIC 16F84A

Just try a bit harder to find out the problem. I used to do a lot with PIC16F84 and I would like to help you but not to check the whole code.
:D
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top