alibataineh
Newbie level 2
![Newbie level 2](/styles/images/ranks/alevel2.gif)
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: