Search Engine

62 Threads found on Portb Interrupt
The exercise problem doesn't mention interrupts, I won't use it here. The processor is doing nothing that must be interrupted, it can just wait for key presses in a loop. If you prefer it though, portb change interrupt might be an option.
a simple program on timer1 to get 1sec delay and successfully compiled in winavr.. but got error push program stack:SP is not initialized .. in proteus.... how to solve it......... #include #include void delay(); void main(void) { SPH=0X00; SPL=0X00; DDRB=0XFF; while(1) {
i am trying to make 2 push button interrupt and to calculate the time elapsed between them using counter t and make the result displayed on port c the problem is that portb rb4 is interrupting automatically i donot why there is my codeint x=0; int t=0; void interrupt(){ if(INTCON.F1){ x = portb; (...)
hello if(INTCONbits.INT0IF == 1){ Trigger_Sensor(); INTCONbits.INT0IF = 0; } in your interrupt treatment, you have RB0 interrupt wich do "Trigger_Sensor();" is pin RB0 used ? if not , remove it.. remove also INTCONbits.GIE = 1; INTCONbits.PEIE = 1; variable temp1 = portbbits.RB4;
It's on portb. 1.) Run init function to setup global interrupts 2.) Write interrupt
You are not telling it to put the result back in portb. from the data sheet: ADDWF Add W and f Syntax: ADDWF f,d Operands: 0 ≤ f ≤ 127 d ∈ Operation: (W) + (f) → (destination) Status Affected: C, DC, Z Description: Add the contents of the W register with register ?f?. If ?d? is ?0?, the
unsigned char x; // interrupt Handler void interrupt() { // RB Port Change interrupt if(PIR1.RBIF == 1) // if the RB Port Change interrupt flag is set... { PORTA.F1 = ~PORTA.F1;//LED on/off on press of switch x = portb; // Need to read or write to the port to clear mismatch (...)
You can connect the TSOP as shown in the tsop datasheet (Image attached) and portb interrupt on change function can be used to detect the pulse. refer the attachments for more 95909
I don't think there are PICS with more than one INT pin. Still most of them have Interrpt on change for portb pins. You can also use CCP modules in the PIC to capture events. As a last resort you can use a 3 input AND gate to tie the three interrupts to the one INT pin of the PIC. Hope this helps :) PS : 16F877A is a midrange PIC with lots of per
hi, i have posted the code ,please can anyone tell me what is the problem in generating the pwm output int freq,rpm,prpm,k; interrupt service routine { k++ portb=0x02; } input capture service routine int crpm=tcnt1; freq=tcnt1; if(tov1) { rpm=((tov1*65535)/freq)+((crpm-prpm)/freq); } else { rpm=((crpm-prpm)/freq); }
Hi, Your simulation will not run until your tie the chips pin 1 to VDD direct or via a pull up resistor 10k. As Rog232 says you can use portb input interrupt functions, but how are you wanting to read the input PWM pulses and how are you wanting to output them on the second pic, directly controlled port pulses or via a PWM module. The latter
Try with this code: unsigned int adc_val; unsigned char FlagReg; sbit Turn at FlagReg.B0; void checkMode() { if (RA2_bit == 0) { portb = 0b00000010; } else { portb = 0b00000100; } } void driveLED(unsigned int adc_val) { if (adc_val >= 0 && adc_val <= 40) { PORTD = 0b00000000; POR
I am using PIC18F4520 MCU I am try to implement interrupt on portb RB4:RB7 interrupt is works ok but RBIF is still 1 even RBIF=0 as per information on datasheet.. "The input pins (of RB<7:4>) are compared with the old value latched on the last read of portb" i did experiment on some condition to input like: 1) made (...)
Hi, In a word, yes it would be possible, however you will need to go though your lcd routine as they often change RB0 from input to output along with the other portb pins. You need to have RB0 totally free of the lcd routine and any TRIS instruction it may use. You need to show the lcd code you are using. On a 40 pin chip like that its ge
this is my full code,,,am using Hi-Tech C compiler... void main() { TRISD=0x00; PORTD=0x00; TRISB=0x00; portb=0x00; TRISE=0x01; PORTE=0x01; lcd_init(); uart_init(); value=200; lcd_string(data); lcd_cmd(0x88); __delay_ms(30); while(1) { lcd_cmd(0x88); __delay_ms(30); if(sw==1) { __delay_m
Use this: char channB = 0; int num = 0; void interrupt (void) //incomplete type is not allowed { if(RBIF_bit == 1) { num++; channB = portb; RBIF_bit = 0; } } You don't need to write isr for the ISR. Just use void interrupt(void){ } When writing/reading bits, you must write _bit at the end. RBIF is
Thank you for your replay. This is the circuit which I used. In the code I wrote, when a interrupt in the INT0 pin, where zero crossing detector is connected, portb.0 become High that mean it trigger the TRIAC. after 1000uS later it become turn off. In this case light become less brightly, around 45voltage AC can be found across the light. But if t
Hi Paradigm; If your proc has PORT Change interrupt (at least on 4 pins like almost all PICs on portb) and it can wake-up from SLEEP (see your datasheet) then it is possible using only one interrupt (this). For example set all 4 keypad columns to zero and pull up (as usual) the rows to VCC. If the 4 rows are connected to the 4 input (...)
Four of the portb pins (RB7:RB4) have an interrupt on change feature. Int0, Int1, Int2 on pins RB0, RB1, RB2. Thats 7 external interrupts