Search found 1557 matches
- 17 May 2024 11:02
- Forum: mikroC PRO for PIC General
- Topic: PIC1F47K42 TIMER1 HELP
- Replies: 4
- Views: 103
Re: PIC1F47K42 TIMER1 HELP
hello, here is an example with Timer1 at 100mS interrupt with a counter to get 10x100mS => 1 sec and Interrupt on RB4 falling edge input ... ( was previously used on RA5) The program show every 1sec intrrupt of timer1 by "." caracter and a togle Led on RA4 output evey RB4 interrupt by '# ' caracter ...
- 16 May 2024 09:31
- Forum: mikroC PRO for PIC General
- Topic: PIC1F47K42 TIMER1 HELP
- Replies: 4
- Views: 103
Re: PIC1F47K42 TIMER1 HELP
hello, Normal way : Never put Delay inside an interrupt .... additional Delay must be less than the Timer delay Timer continue to run during the Delay if removing this delay , you simply can just add PIE4.TMR1IE = 0; //DISABLE TIMER1 INTERRUPT so , only one shoot of interrupt .. keep led ON if inter...
- 11 May 2024 13:17
- Forum: mikroC PRO for PIC General
- Topic: 1 uSec using Timer1 on PIC12F675
- Replies: 6
- Views: 177
Re: 1 uSec using Timer1 on PIC12F675
hello,
As you can see in the figure Register 2-7 ESCAL OSCILLATOR CALIBRATION REGISTER
The OSCAL is set à 4MHZ by default
CAL5=1 CAL4=0 CAL3=0 CAL3=0 CAL2=0 CAL1=0 CAL0=0
so bit 7-2 )= 100000 => Center frequency
you have nothing to do , to use 4MHz ... set by default on Reset..
As you can see in the figure Register 2-7 ESCAL OSCILLATOR CALIBRATION REGISTER
The OSCAL is set à 4MHZ by default
CAL5=1 CAL4=0 CAL3=0 CAL3=0 CAL2=0 CAL1=0 CAL0=0
so bit 7-2 )= 100000 => Center frequency
you have nothing to do , to use 4MHz ... set by default on Reset..
- 10 May 2024 19:46
- Forum: mikroC PRO for PIC General
- Topic: 1 uSec using Timer1 on PIC12F675
- Replies: 6
- Views: 177
Re: 1 uSec using Timer1 on PIC12F675
Even with a quartz of 20MHZ 1 Cycle is allways 4/FOSC (MHz) in µS 1 Cycle time = 1/20 *4 = 4/ 20 => 0.2µS if interrupt duration takes more than 5 cycles => 1µS ... include also the call interrupt (time) and return (time) to the main programm the MCU has no time to do else ... So, you can do nothing ...
- 10 May 2024 17:52
- Forum: mikroC PRO for PIC General
- Topic: 1 uSec using Timer1 on PIC12F675
- Replies: 6
- Views: 177
Re: 1 uSec using Timer1 on PIC12F675
hello, Impossible to use a timer with 1µS delay with at Fosc 4MHz , 1 cycle T=FOSC/4= 1µS 1 NOP execution need 1µS so if you want a delay of 1µS, just use : _asm nop; your interrupt treatment needs more than 4µS to be executed !! or use 18F27K42 with FOSC=64Mhz by internal special hardware 24 bits c...
- 09 May 2024 16:20
- Forum: mikroC PRO for PIC General
- Topic: MikroC compiler
- Replies: 2
- Views: 98
Re: MikroC compiler
Hello, Tell us , wich MCU are you using...? it is OK with a 18F26K22 .... using PIckit3 18F27K42 .. a little bug to load eeprom data into the MCU you must modify starting adress manualy in the *.ihex file using Pickit4 Now , you better have to use MPLABX XC8 ! as me ...for new MCU. Even MikroC (with...
- 09 May 2024 08:46
- Forum: mikroC PRO for PIC General
- Topic: TCS3472 and PIC16F877A
- Replies: 1
- Views: 64
Re: TCS3472 and PIC16F877A
hello, You need to use a I2C bus ..to dialogue with TCS3472 then use a LCD or Terminal PC to display your data i give you a starting example for 16F877 wich use I2C for a RTCDS1307 ,and read & write to an EEPROM 24LC256 Display infos on a Nokia LCD ( from old phone) or Nokia5510 or ...use a I2C LCD ...
- 07 May 2024 18:05
- Forum: mikroC PRO for PIC General
- Topic: HELP WITH FUNCTIONS
- Replies: 1
- Views: 187
Re: HELP WITH FUNCTIONS
Hello, Are MILES and MILESt variables declared as Global ? long MILES; long MILESt; why did you put My_DatA as a comment ? Be carrefull ! My_Dat A is not the same variable as My_Data ! unsigned short My_EEPROM_Read(unsigned int address) { //unsigned short My_DatA; <---- ? NVMCON1=0; //reset all to 0...
- 03 May 2024 18:21
- Forum: mikroC PRO for PIC General
- Topic: UART1_Read_Text() is not working when I used escape sequences like \r\n
- Replies: 6
- Views: 216
Re: UART1_Read_Text() is not working when I used escape sequences like \r\n
hello, UART can be blocked if OVERFLOW occurs !!! and error not treated ! when adding a delay , if data are always send by your terminal, during this laps of time .. MCU itslef can't store incomming data anymore -> OVERFLOW i don't know how MikroE manage the function UART1_Read_Text(uart_input,";", ...
- 01 May 2024 17:22
- Forum: mikroC PRO for PIC General
- Topic: UART1_Read_Text() is not working when I used escape sequences like \r\n
- Replies: 6
- Views: 216
Re: UART1_Read_Text() is not working when I used escape sequences like \r\n
next thing you are talking about interrupt, could you explain more about this thing like, how to use interrupt? tested on PIC12F1840 #define MAXLEN1 64 char Buffer1[MAXLEN1]; unsigned short error; volatile unsigned int CptErr; volatile int DataReady1 =0; // drapeau Data recu volatile int NB; volati...
- 30 Apr 2024 09:34
- Forum: mikroC PRO for PIC General
- Topic: PIC18F47K42 EEPROM
- Replies: 4
- Views: 171
Re: PIC18F47K42 EEPROM
hello, Since One year, i not use anymore MikroC ..because not updated for new MCU Must use Necto Studio wich replace MikroC , but it is to much complicated and Heavy.... and need additional cost to pay !! even you allready have a MickroC Pro Licence. i use MPLABX XC8 , mode difficult to learn, but a...
- 30 Apr 2024 08:52
- Forum: mikroC PRO for PIC General
- Topic: UART1_Read_Text() is not working when I used escape sequences like \r\n
- Replies: 6
- Views: 216
Re: UART1_Read_Text() is not working when I used escape sequences like \r\n
Hello, you can try this : Delay located outside of RX loop while(1) { if(UART1_Data_Ready() == 1){ UART1_Read_Text(st, ";", 255); UART1_Write_Text(st); strcpy(str,st); } else{ UART1_Write_Text(str); } UART1_Write_Text("\r\n"); Delay_ms(1000); } A better way is to use interrupt to manage RX UART ...
- 29 Apr 2024 10:28
- Forum: mikroC PRO for PIC General
- Topic: PIC18F47K42 EEPROM
- Replies: 4
- Views: 171
Re: PIC18F47K42 EEPROM
Hello, :o There is a bug in MikroC compiler !!!! it is a old problem, not solved by MikroE .. usage de l'eeprom PIC Rappel bug MikroC sur adresse départ Eeeprom => à modifier! dans Eeeprom file *.ihex OLD adresse :02000004[b]0121[/b]D8 2101H because reverse order : LSB then MSB [b]NEW adresse[/b] :0...
- 26 Apr 2024 08:03
- Forum: mikroC PRO for PIC General
- Topic: PIC18F47K42 USING DS1307 CLOCK I2C
- Replies: 2
- Views: 208
Re: PIC18F47K42 USING DS1307 CLOCK I2C
hello, you can find here all you need to use I2C1 , specific for 18F27K42 ... without mikroC library ... used for OLED display and DS3231 RTC needs to add specific register names, not included in MikroC registres I2C du MCU 18F27K42 sbit I2C1STAT0_BFRE at I2C1STAT0.B7; sbit I2C1STAT1_TXBE at I2C1STA...
- 17 Apr 2024 15:04
- Forum: mikroC PRO for PIC General
- Topic: can I read two digit number using UART1_Read()?
- Replies: 7
- Views: 1362
Re: can I read two digit number using UART1_Read()?
hello, .....Your code is working fine. but if print number in next line it will not work. char c: int value; int i=0; .. somme init here.... do { i=0; if ( (UART1_Data_Ready())&& (i==0)) { c=UART1_Read() ; UART1_Write (c); // echo '6' en ascii value=( c-48)*10; // value=6*10=60 i++; } if ((UART1_Dat...