Search found 71 matches

by Ditch
28 Dec 2023 13:50
Forum: mikroC PRO for PIC General
Topic: Pic18F45K22 - RS485 & I2C At The Same Time
Replies: 2
Views: 341

Pic18F45K22 - RS485 & I2C At The Same Time

Hi All, I'm playing around with a Pic18f45k22 with RS485 & I2C working at the same time. My code is below and this is working fine and i have communication with the RS485 slave but when I uncomment the '//minutes = ReadFromDS3231(1);' at the bottom of my main loop, my RS485 comms stops and i get no ...
by Ditch
22 Jul 2023 10:35
Forum: mikroC PRO for PIC General
Topic: Pic16F18855 Timer 1 Not Working.
Replies: 4
Views: 558

Re: Pic16F18855 Timer 1 Not Working.

I think ive sorted this.

I've changed OSCCON1 = 0x92; to OSCCON1 = 0x60; and the Timer 1 interrupt is now working.

Ian
by Ditch
22 Jul 2023 09:53
Forum: mikroC PRO for PIC General
Topic: Pic16F18855 Timer 1 Not Working.
Replies: 4
Views: 558

Re: Pic16F18855 Timer 1 Not Working.

Thanks mikroBee, As far as I can see, i've set all I/O directions correctly. I have 3 banks of dip switches which create a binary value depending on their settings. I can set any binary number on any dip switch and assign this value to the test_led and this works as expected. The test_led is also se...
by Ditch
22 Jul 2023 00:42
Forum: mikroC PRO for PIC General
Topic: Pic16F18855 Timer 1 Not Working.
Replies: 4
Views: 558

Pic16F18855 Timer 1 Not Working.

Hi All, I've spent hours on this but i can not get the timer 1 interrupt working using the Pic16F18855 and Pro for Pic. I've tried the example given by the Timer Calculator (V4.0.0) and looked through the datasheet but i'm obviously missing something. I have proven that test_led does light by using ...
by Ditch
29 Dec 2022 01:10
Forum: mikroC PRO for PIC General
Topic: Time digits to separate int's?
Replies: 2
Views: 573

Time digits to separate int's?

Hi There, I'm struggling with this and finally asking for help! I have an int Hr which contains the current hour. EG. 2 for 2am, 14 for 2pm, 18 for 6pm etc. I'm trying to split these down into separate digits so for example, int hr_msb = 1 & int hr_lsb = 8 for 18. Can anybody help me with this? Ian
by Ditch
13 Jul 2022 19:55
Forum: mikroC PRO for PIC General
Topic: Can I access individual bit values from a byte?
Replies: 2
Views: 548

Re: Can I access individual bit values from a byte?

The below works if this helps anybody else...

Code: Select all

unsigned int Rx_buff[10] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A};

uint8_t bit_value;

bit_value = Rx_buff[9];
bit_value = ((bit_value >> 5)  & 0x01); //bit_value will now be showing the state of bit 5


by Ditch
12 Jul 2022 21:00
Forum: mikroC PRO for PIC General
Topic: Can I access individual bit values from a byte?
Replies: 2
Views: 548

Can I access individual bit values from a byte?

Hi There, I'm hoping somebody can help me. I'm reading the status of a PSU via uart and happily receiving a status byte with a hex value of 0x16 which is a binary value of bx00010110; If I remove the batteries from the PSU's charger then the PSU recognises the change of state and changes the hex to ...
by Ditch
20 Mar 2022 03:14
Forum: mikroC PRO for PIC General
Topic: More Interrupt Woes
Replies: 7
Views: 1291

Re: More Interrupt Woes

Dave, I really do appreciate your input but I've decided to move away from the K42 family. More development, support and knowledge is needed with these :roll: . There are not many microchips available at the moment but this chip was available at the time which maybe should have raised concerns as to...
by Ditch
19 Mar 2022 12:27
Forum: mikroC PRO for PIC General
Topic: More Interrupt Woes
Replies: 7
Views: 1291

Re: More Interrupt Woes

Thanks Dave, I've tried it... I've tried everything but can't get it to work! I can output the status of the GIE_bit state to the lcd and it is showing as set. What I have noticed is that cnt (when cnt is uncommented) has not incremented when shown onscreen so i'm now assuming its a problem with my ...
by Ditch
18 Mar 2022 14:31
Forum: mikroC PRO for PIC General
Topic: More Interrupt Woes
Replies: 7
Views: 1291

Re: More Interrupt Woes

Thanks for your reply Dave, Yeah, data_led continues to flash. On boot, the output_led in the interrupt flashes for 1000ms but stops when tft_init(); is called. At which point, data_led starts to flash. If I comment out tft_init(); then both led's flash which would suggest that that the Timer 0 inte...
by Ditch
16 Mar 2022 14:38
Forum: mikroC PRO for PIC General
Topic: More Interrupt Woes
Replies: 7
Views: 1291

More Interrupt Woes

I have an issue using Timer0 interrupt using Pro for Pic and PIC18F46K42! I have the below code which is a basic script for running the ST7789 display from Libstock (here - https://libstock.mikroe.com/projects/view/3199/interfacing-pic18f46k22-mcu-with-st7789-tft-display ) This is working fine and w...
by Ditch
13 Mar 2022 20:39
Forum: mikroC PRO for PIC General
Topic: PIC18F46K42 Timer Inturrupt Not Working
Replies: 2
Views: 679

Re: PIC18F46K42 Timer Inturrupt Not Working

For others struggling with this on the PIC18F46K22 chip, the below works. There is actually an example file in the Multiple interrupts (IVT) folder. int cnt; void IVTTimer0_ISR() iv IVT_TMR0 ics ICS_AUTO { PIR3.TMR0IF = 0; // Clear TMR0 TMR0H = 0x0B; // Set TMR0 for aproximetly 1 sec TMR0L = 0xDC; c...
by Ditch
11 Mar 2022 22:01
Forum: mikroC PRO for PIC General
Topic: PIC18F46K42 Timer Inturrupt Not Working
Replies: 2
Views: 679

PIC18F46K42 Timer Inturrupt Not Working

I've had to change chip because my original is not available. I chose to go with the PIC18F46K42 but I can not seem to get the Timer0 interrupt working. I've been at this all day and I'm just going around in circles now. By searching through this forum, I have compiled the below but this does not wo...
by Ditch
20 Feb 2022 00:37
Forum: PIC PRO Compilers
Topic: Help With PIC18F46K42 Datasheet
Replies: 4
Views: 1671

Re: Help With PIC18F46K42 Datasheet

Ok, Thanks for your replies,

I think I may look for a different chip, the further I look into this the more I think my primitive brain will struggle to change the libraries from IC2 to IC2_remapable etc.

Many Thanks
Ian

Go to advanced search