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.

[PIC] asm pira counter

Status
Not open for further replies.

radium98

Full Member level 2
Full Member level 2
Joined
Jul 19, 2009
Messages
129
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
leb
Activity points
2,291
Hello ,i have this public assembly file from pira counter that use pic16f84a ,at start i read on the 4 digits bcd PIRA
i need to change it and make a little delay ,because it flash so fast for micro second , ineed to make it for 3 seconds.But i can not find the reel word pira or the timer ,i have attach the file if you can help me
thanks
 

Attachments

  • counter.rar
    1.5 KB · Views: 140

The author has hidden the 'PirA' in the code. It is near the top of the listing in the block above the subroutine 'COUNT' and the delay is the routine 'COUNT' itself.

Brian.
 
It would be good to test this on the demo of Proteus. On this version of Proteus, the PIC16F84A is usable with the Proteus ASM compiler. You can not save the project, but it doesn't matters. It will help you in the testing. It also makes the switching visible, because it shows it a lower speed.
 
So Brian i can not change it ?
 

Of course you can change it. Look closely at the commands I pointed out, it doesn't tell it to display 'Pira' directly, it just turns the individual segments on or off to make the characters appear. You can change the segments to make different characters and alter the timing to set how long it shows for then recompile the instructions.

You will have to run the changed code through an assembler to make it executable again.

Brian.
 

I know Brian it is dowable , but sadly i am not familiar with reading to much instructions ,the compiler can be the mplab , i have no problem with that ,if you can give me a hand of help
thanks
digit0 to digit3 ? but what i do have to change or convert ,ascii or what ,i am just going to pla y with it ,learning something but i need a hand of help
 

You will have to learn about assembler instructions to know how the code works but it isn't as difficult as it sounds. The code is poorly written, it has no worthwhile comments and for some reason the register names and bit names have been duplicated. If you run it through an assembler you will also need the file called "p16f84A.inc" which I think is still included with MPLAB. Expect some warning messages but it should still produce a usable HEX file.

Start by looking at the schematic and see how the bits in PORTA and PORTB are used to activate the display. PORTA and PORTB are outputs from the PIC except for bit 0 on PORTB which is an input. You will see that each bit in the ports is connected to something on the schematic. The ones you need to be interested in are:
PORTA bit 0 - (RA0) - when low it activates digit 0
PORTA bit 1 - (RA1) - when low it activates digit 1
PORTA bit 2 - (RA2) - when low it activates digit 2
PORTA bit 3 - (RA3) - when low it activates digit 3

PORTB bit 0 -(RB0) - this is the input that counts the edges of the signal to work out the frequency
PORTB bit 1 - (RB1) - when low it activates segment E on all the digits
PORTB bit 2 - (RB2) - when low it activates segment C on all the digits
PORTB bit 3 - (RB3) - when low it activates segment D on all the digits
PORTB bit 4 - (RB4) - when low it activates segment A on all the digits
PORTB bit 5 - (RB5) - when low it activates segment F on all the digits
PORTB bit 6 - (RB6) - when low it activates segment B on all the digits
PORTB bit 7 - (RB7) - when low it activates segment G on all the digits.

The way it produces the digits is to load the pattern of segments for digit 0 into PORTB then it makes RA0 low so the segments lit up produce the character, then it makes RA0 high again and repeats for digits 1, 2 and 3 before going back to digit zero again. Only one of the digits is active at any time, otherwise the same character would appear on more than one digit. By going round in circles, briefly displaying each digit then turning it off again, and doing it fast enough that your eyes don't notice the flicker, it looks like all four digits are lit up at the same time. We call this 'multiplexing' and it is used very frequently so it is worth understanding.

To make the "Pira' name, if you look close at this fragment of the code:
Code:
        CLRF    DIGIT2
        CLRF    DIGIT1
        CLRF    DIGIT0
        BSF     DIGIT0,3
        DECF    DIGIT1
        DECF    DIGIT2
        MOVF    DIGIT1,W
        MOVWF   PORTA
        BSF     DIGIT0,2
        CLRF    DIGIT3
        BCF     DIGIT1,1
        BCF     DIGIT1,5
        INCF    DIGIT0
        BSF     DIGIT3,3
        INCF    DIGIT3
        BCF     DIGIT2,7
        BCF     DIGIT2,1
you will see it sets the bits (BSF) or clears the bits (BCF) in four variables called "DIGIT0", "DIGIT1", "DIGIT2" and "DIGIT3" to make the segment pattern for P, i, r, a then it starts to send those variables to the display using the multiplexing I described above.

So it doesn't use ASCII at all, it directly turns the segments on or off to make the character shapes.

Brian.
 
i will see , and if failed i ask the help again ,thank you for patience.Very very detailed thanks a lot.
the next part will be the delay to show the digits for more than x seconds .
yes i understand very well what you explained to me ,and let me learn .thanks
--- Updated ---

If i understand correctly this i have to edit ,but how and if you can do the next step to me :) Brian.
i attached everything for also who may want to learn like me and be helped.
the last picture is what i should have as a result but in the asm file i do not understand how do i have to edit if you can make to me the first letter i need to write rd98 my nickname
so write to me instead of the P from Pira the r from rd98
thanks
 

Attachments

  • counter.gif
    counter.gif
    8.6 KB · Views: 187
  • hd-m51x.gif
    hd-m51x.gif
    136 KB · Views: 186
  • img001.jpg
    img001.jpg
    239.4 KB · Views: 185
Last edited:

@betwixt betwixt any further help ? just came to the end as you may help me before and thanks again and sorry .
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top