Search Engine


Add Question

70 Threads found on Intcon
intcon interrupt should launch the timer. When timer will be updated, another interrupt will perform switching the triac.
Hello, I need help. PIC USED 18F46J50 Compiler MikroC PRO Set RX2 and TX2 in the RP0 RP1. Puertos TX1 and RX1 occupied. code used { RCSTA2.SPEN=1; // activate USART2 TRISA.F0=1; //RX2 Input TRISA.F1=0; //TX2 Output intcon.GIE=0; // disable interrupts EECON2=0X55; // EECON2=0XAA; PPSCON.I
void interrupt() // Interrupt ISR { LATD=~LATD; // Invert (Toggle) the value at PortD Delay_ms(500); // Delay for 1 sec intcon.INT0IF=0; // Clear the interrupt 0 flag }
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; intcon.f0=0; intcon.F1=0;
I have MPLAB V8.73 and I'm using MPLAB SIM to simulate a programme I wrote for a PIC 16F684. I want to drive TMR1 with a 32.768 kHz crystal. But when I try to simulate this situation, TMR1 does not change. I set _INTOSC_OSC_NOCLKOUT in the configuration and the following bits in the programme:- PIE1, TMR1IE intcon, PEIE T1CON, TM
Hi guys, I'm using the PIC18F46k22 mcu and I'm using two function in my high priority interrupt routine: #pragma code #pragma code My_HiPrio_Int=0x0008 #pragma code #pragma interrupt chk_isr #pragma code void My_HiPrio_Int(void) { _asm GOTO chk_isr _endasm } void chk_isr(void) /*Serial Interrupt*/ { intconbits.GIE
I'm trying to communicate PIC18F4550 with biomed module. I'm very new to embeded My Module send a packet of 5 byte information continuously at 4800 baud, 1 stop, ODD parity. I've set my baud rate perfectly BRGH=1, BRG16=1. my main is void main() { intcon=0xC0; RCSTA=0x80; TXSTA=0x24; BAUDCON=0x08; PIE1bits.RCIE=1; IPR1bits.RCIP=1;
1. you need a resistor in series with the LED. 2. you should rewrite the code with some structure to it. Get rid of those 'goto' instructions and jumps from within one loop to another. I would suggest you do it like this: char ButtonPushed=0; void interrupt() { if (intcon.INTF) { ButtonPushed = 1; intcon.INTF=0; } } void
unsigned int time = 0; //Timer1 //Prescaler 1:8; TMR1 Preload = 3035; Actual Interrupt Time : 500 ms //Place/Copy this part in declaration section void InitTimer1(){ T1CON = 0x39; TMR1IF_bit = 0; TMR1H = 0x0B; TMR1L = 0xDB; TMR1IE_bit = 1; intcon = 0xC0; } void Interrupt(){ if (TMR1IF_bit){ TMR1IF_bit = 0;
Guys, How can I reduce the 32bits counter on Microchip assembly ? I've done 16 bits : LedTimer RES 2 ; these lines will be done on 100ms Timer0 interrupt (btfss intcon,T0IF) movf LedTimer,w ;for every 10 counts btfss STATUS,Z ;check the counter if it's already zero return
hi, i want to my pic12f675 to enter in sleep mode, and wake up by pin interrupt; this is my code: intcon=0xD0; OPTION_REG=0; IOC=0x0f; WPU=0x27; TRISIO = 0x0F; // output GP4 #asm sleep; #endasm while (1); by this code i can wake up by MCLR but i want also wake it by GP2/INT pin, what should i a
Hi, Your sublw.1 does just that, subracts 1 from whatever was in W, hard to tell if that was COUNTs value without seeing all your code. The thing is, the result of sublw is saved in W , not in COUNT so it is never reduced. Use this instruction instead. check_counter btfss intcon,T0IF goto check_counter
void interrupt(){ if(intcon.TMR0IF){ intcon.TMR0IF = 0; TMR0H = x; TMR0L = y; timer++; } } void main(){ //Initialize and start Timer0 here while(1){ if(my_variable <= timer){ } } }
1. Delay_ms(2000); // don't need such delay for intializing USART port try this sample code: void main(void){ intcon = 0; TRISA = 0x00; TRISB=0x00; ANSELA = 0x00; ANSELB = 0x00; UART1_Init(9600); Delay_ms(10); UART1_Write_Text("\r\nATE0\r\n"); int
It's basically OK except for a few minor bugs: 1. in main() you change the values of some registers then change them again in the next instruction. Only the last value will be used. Set all the intcon bits and all the OPTION_REG bits in one instruction each. 2. Dont change the GIE bit inside the interrupt routine. The PIC automatically clears it w
Post your code. You have to use this code for 5 ms Timer 2 Interrupt //Timer2 //Prescaler 1:16; Postscaler 1:7; TMR2 Preload = 223; Actual Interrupt Time : 4.9966 ms //Place/Copy this part in declaration section void InitTimer2(){ T2CON = 0x36; PR2 = 223; TMR2IE_bit = 1; intcon = 0xC0; } void Interrupt(
If you mean SPI or I2C: Set GIE/GIEH (bit 7 of intcon register). Set PEIE/GIEL (bit 6 of intcon register). Clear SSPIF (bit 3 of PIR1 register). Set SSPIE (bit 3 of PIE1 register). That's the setting for interrupt. Set up the MSSP module for required operation. Do the necessary actions in the ISR (Interrupt Service Routine). If you mean UART:
Try intcon.INT0IE = 1;
Hi, I am using pic 16f676 and mikroc compiler, i facing problem in external interrupt(INTE), interrupt occurs at first time and next time onwards its not responding, below is my code, please help me out wats wrong with my program..... thanks in advance... #define red PORTC.F0 #define green PORTC.F1 #define blue PORTC.F2 #def
Yes, you can test it by 'loop-back' so it sees it's own data. The transmitting and receiving is done in hardware and starts as soon as you write to the TXREG register. All you have to do is wait for the RCREG register to tell you somethng has arrived by checking the RCIF bit in intcon. I'm not sure where the trm 'high speed' baud rate comes from,