alibataineh
Newbie level 2
- Joined
- Dec 17, 2012
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,298
Hello everyone,
Hope you're doing well .
I study power engineering and this is my third year. To be able to graduate I have to pass micro-controller course, even though it's not related to my field of study.
Anyway, I was searching online and I'm really thrilled to find this site.
I need your help regarding programming TMR0 as counter. Does anyone know how to write a program to count the number of negative pulses received on one of the PIC 6F877 I/O pins ?
This code actually counts the positive pulses :
main:
; 1. configure tmr0
; 2. Set up ports
; 3. Mask 2nd digit of TMR0
What about the negative pulses ?
Thank you in advanced,
You'd really save my life if you know the code
Peace
Hope you're doing well .
I study power engineering and this is my third year. To be able to graduate I have to pass micro-controller course, even though it's not related to my field of study.
Anyway, I was searching online and I'm really thrilled to find this site.
I need your help regarding programming TMR0 as counter. Does anyone know how to write a program to count the number of negative pulses received on one of the PIC 6F877 I/O pins ?
This code actually counts the positive pulses :
main:
; 1. configure tmr0
Code:
movlw b’10111000’
movwf option_reg
Code:
movlw 0x00 ;
Movwf trisd
movlw B’00011111’ ;
Movwf trisa ;
Code:
loop:movf trm0,w ;
Andlw 0x0f;
call segment
movwf portd ;
goto loop ;
What about the negative pulses ?
Thank you in advanced,
You'd really save my life if you know the code
Peace
Last edited by a moderator: