Search Engine www.edaboard.com

Intcon

Add Question

70 Threads found on edaboard.com: 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
Hi Guys, I'm just starting out in the world of C and micro-controllers and I set myself a simple beginners task of using an external switch + counter + LED, all I want to do is: When the external switch gets pressed, increment the counter by 1, when the counter gets to five blink the LED. The code is below, and the problem seems to be that
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;
It might be better to let the interrupt routine just increment the mode_count. It is not a good idea to spend too much time in the interrupt routine. Why do you clear the flag in your main loop? while(1) { intcon.INTF = 0; ????? rgboff(); } Something like this. volatile unsigned char mode_count = 0; void main()
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,
i configured portb change interrupt BSF intcon, GIE BSF intcon, RBIE BCF OPTION_REG,RBPU so i simulated with Proteus. when I enable the pullup, it automatically interrupt without press the button Hi; It is due the wrong order. First set the used PORTB pin(s) as input via TRISB then clear RBPU to en
Something like this should work: banksel intcon btfss intcon, INTF goto NotRaised ;Flag is not raised, so go to a label called NotRaised bcf intcon, INTF goto Raised ;Flag is raised, so go to a label called Raised. INTF has been cleared What exactly do you mean by initialization of
Hi, Its nice to see well written code with plenty of comments added. You are very close to the problem, just amend the three lines of your code as below and it interrupts ok. bSf RCON,IPEN ;ENABLE Hi/Lo priority interupts - default ; bsf intcon,PEIE/GIE ; peripheral interupts enabled bsf INTC
Hello! Im trying to set up a timer interupt with the lenght of 1 sec useing the T0CON register. Needless to say im new to the assembly language and pic programming. init bcf TRISB,6 clrf TRISC movlw b'00000111' movwf T0CON movlw 0xff movwf TMR0H movlw 0xf2 movlw TMR0L bcf intcon,TMR0IF bsf T0
unsigned int counter; unsigned int sec; unsigned int mins; unsigned int hour; unsigned int day; void interrupt() { if(intcon.TMR0IF) { // if timer 0 overflow counter++ ; if(counter==3907) { // one second has elapsed counter = 0 ; sec++ ; if(sec == 60) { // one minute has alapsed sec = 0 ; mins++ ; if(mins == 60) { // one hour has elapsed mins = 0
These are the code snippets: port settings: I did not include the other port settings ADCON1 = 0x0F; intcon = 0x00; TRISC = 0x00; PORTC = 0; I'm using PORTC.F0 up to PORTC.F3. Port F0, F1, and F3 works just fine but at F2 otherwise I'm thinking it is because of PORTC.F2 is multiplexed with CCP1/P1A. Is it possible to disable
I do not use the CCS compiler so not sure of how it works, but you should not have to define the register addresses. They are defined in the 16LF727.h file? Looking at the data sheet, the intcon address is 0x0b, but you have defined it as 0x8. Could this be the problem?
Hi everybody.. I write this C code for servo motor control and simulate with proteus ISIS. But it can't work fully. Please help me ..what wrong. I think.. this wrong.. tmr1l=0xee; tmr1h=0xfc; intcon=0xa0; t1con=0x87; ********************************************************** int servo1,servo2,servo3; void servo_1(int servo1); void serv
So, in your code, add these: ADCON1 = 0xFF; ADON_bit = 0; intcon = 0; Set PBADEN off. Turn debug off. These were all mentioned in previous posts. I'm summarizing it here for you, because right now, I can't think of another reason for it not to work on PORTB if it works on PORTC.
when you get the IOC interrupt are you doing a READ of the port BEFORE clearing the interrupt? and do this at the end of your isr ? ie MOVF _ISerialRxPort,0 ;read the port BCF intcon,RAIF retfie also additionally to handle your IOC in the isr along with other interrupt sources (flags) you should check IOC enabled flag becau
int run=0; void interrupt(void){ intcon.INTF = 0; portd=~portd; } void main() { TRISB = 0x01; PORTB=0; TRISd = 0x00; portd=0x3f; intcon.GIE = 1; intcon.INTE = 1; intcon.intf=0; intcon.PEIE = 0; OPTION_REG.INTEDG = 1; do (...)
hi i'm trying to use three external interrupts... in this code the interrupts are working fine.. (I tested it with LED) But i Cant Read Or Update the mic_num in this code #define LED PORTD.F0 unsigned int mic_num = 0; void interrupt() { if(intcon.F1 == 1) { mic_num = 1; } else if(intcon3.F0 == 1
Dear BigDog Thanks for reply it does not show how configure external pins, it show configure SCL and SDA line only can you see any error the program I wrote for I2C status equ 0x03 ;bank 0 intcon equ 0x8b ;bank 0 pir1 equ 0x0c ;bank 0 sspbuf equ 0x13 ;bank 0 sspadd equ 0x93 ;bank 1 sspcon equ 0x14 ;bank 0
Hi my friends. I have an problem in my code! I wanna send 'INIT' to PC and then read data from it but I can't!because of TXIF flag bit! when I am config bits and registers suddnely TXIF =1 and my program jump in interrupt routin! I clear TXIE but when i wanna send 'INIT' to pc I must check TXIF and it is 1 logic so 'N' dosn't send to pc!here i
If you are using a timer it you must enable also the PEIE bit: intcon.6 (PEIE), Peripheral Interrupt Enable bit ... 1 = Enables all unmasked peripheral interrupts
I didn´t see the following command at Interrupt() routine : intcon.INTF = 0; Neither that at begin : intcon.GIE = 1; //Enable Global Interrupt +++
You should enable GIE and teh correspondent INTxIE register. For INT0IE both are on intcon. DOnt forget to clear the flag!! Cya
int Counter=0; void interrupt() { intcon=0x20; //Clear the GIE and the T0IE TMR0=0; //Re-initialize TMR0 register ++Counter; //Increment the dummy variable } void main() { TrisB=0; //Configure PortB as Output TrisA=255; //C
According to datasheet section for "Interrupts" following registers are involved with registers, • RCON • intconintcon2 • intcon3 • PIR1, PIR2 • PIE1, PIE2 • IPR1, IPR2 Check function of each and every bit of all above registers and count "interrupt flag" bits. See following link for software (...)
Hi, Assume you are still working on the 4550 ? You do not show all your code, have you fully enabled the Interrupts ? bsf intcon,PEIE ; ENABLE PERIPH INT bsf intcon,GIE ; ENABLE GLOBAL INT
Hi, Do not put delays in your interrupt routine ... void interrupt(void) { if(intcon.INTF == 1) { PORTD = 0x01; //To see if interrupt is triggered //Delay_ms(2000); intcon.INTF = 0; //You HAVE to clear interrupt flag } }
Hi, In the interrupt you set intcon = $20, change that to intcon = $A0. The problem is, you're waiting in the interrupt for 400ms, that's why the other stuff aren't happening in the main code, because, interrupt occurs every few microseconds and then stays there for 400ms. You can't have delays in the interrupt. This completely ruins the purpose of
hi there! i really need to now why this code is not right!because in PIC simulator ide and protues it can't work! processor p16f84a include __config _WDT_OFF & _CP_OFF & _XT_OSC & _PWRTE_OFF org 0x00 goto peykar org 0x04 goto check peykar bsf STATUS,5 movlw 0x80 movwf OPTION_REG clrf TRISB bcf STATUS,5 c
i got it.... #byte intcon=0X0B #bit GIE=intcon.7 GIE = 1;
Hi, This is the fixed code: unsigned int gCOUNT; void interrupt(void){ //Interrupts must be handled through subroutine like this ++gCOUNT; intcon.INTF = 0; //You HAVE to clear interrupt flag } void main(void){ TRISB = 0x01; TRISA = 0x00; intcon.GIE = 1; //Enable Global Interrupt intcon.INTE = 1; //Enable RB0/INT e
unsigned short m, k; unsigned short userRD_buffer; unsigned short userWR_buffer; void interrupt() { asm CALL _Hid_InterruptProc asm nop }//~ void Init_Main() { // Disable all interrupts // Disable GIE, PEIE, TMR0IE, INT0IE,RBIE intcon = 0; intcon2 = 0xF5; intcon3 = 0xC0; // Disable Priority Levels on interru
Hi, I'm assuming this is mikroC compiler. In that case, first, you need to set the INT0 pin as digital input: Assuming this is 16F877A, you need to set RB0 as input as : int count=0; void interrupt() // Interrupt function definition { intcon.INT0IF=0; count++; } void main() { T
Hi, For an 8MHz clock with HSPLL turned off in the configuration bits, this would be an initialization code: T0CON = 0x08; //Timer0 prescaler 1:1, timer off intcon.TMR0IE = 1; //Timer0 interrupt enabled intcon.GIE = 1; //Global interrupt enabled TMR0H = 0xF8; //Preload value for 1ms TMR0L = 0x2F; T0CON.T
have you done the settings for INTEDG, & other settings required that is intcon(may be different for your controller)
Hi, A few things: 1. No need to define PortA, PortB, TrisA, TrisB, OPTIONS_REG, TMR0, intcon. Since you have included "P16F873A.INC", just use PORTA, PORTB, TRISA, TRISB, OPTION_REG, TMR0, intcon and no need to decleare these SFRs. .