We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
posted on 2021/04/16 07:15:44 PM CEST
help for code for 89c2051 based sweep generator with 3 Khz to 33 khz frequency 50% duty cycle 3 Khz stepping and 1000 mS delay between steps.
posted on 2021/03/16 10:26:54 PM CET
Hi,
I recently bought Easy PIC Fusion 7 Development board and trying to interface SHT31 Sensor with Microcontroller P24EP512GU810 using MikroC. I have been trying from last couple of days but no luck yet. Any kind of help will be much appreciated. I am not using the in built library because I dont have the SHT3x click and, I am using SHT31 probe from DFRobot (https://wiki.dfrobot.com/SHT31_Temperature_Humidity_Sensor_Weatherproof_SKU_SEN0385). Below is my code:
unsigned int t_m=0, t_l=0, t_c=0, h_m=0, h_l=0, h_c=0;
void SHT31_measure() {
I2C2_Start(); // issue I2C start signal
if(I2C2_Write(68)==0){ // send byte via I2C + W (command to SHT31)
UART1_Write_Text("Yes");
}
else UART1_Write_Text("No");
I2C2_Write(0x2c); // Single Measurement Mode
I2C2_Write(0x06); // Clock Streching Enabled / High Rpeatability
I2C2_Stop();
Delay_ms(5);
I2C2_Start();
I2C2_Write(69); // send byte via I2C + R (command to SHT31)
Delay_ms(200); // Wait for measurement to be done
t_m = I2C2_Read(0); // Temperature MSB and Send Acknowledge
t_l = I2C2_Read(0); // Temperature LSB and Send Acknowledge
t_c = I2C2_Read(0); // Temperature CRC and Send Acknowledge
h_m = I2C2_Read(0); // Humidity MSB and Send Acknowledge
h_l = I2C2_Read(0); // Humidity LSB and Send Acknowledge
h_c = I2C2_Read(1); // Humidity CRC and Send Not Acknowledge
I2C2_Stop();
UART1_Write_Text("Data Read Done");
UART1_Write(13);
UART1_Write(10);
}
void main() {
// Setting output frequency to 140MHz
PLLFBD = 70; // PLL multiplier M=70
CLKDIV = 0x0000; // PLL prescaler N1=2, PLL postscaler N2=2
ANSELA = 0x00; // Convert all I/O pins to digital
ANSELB = 0x00;
ANSELC = 0x00;
ANSELD = 0x00;
ANSELE = 0x00;
TRISA = 0x00; // Make port A as Output
PPS_Mapping(100, _INPUT, _U1RX); // Sets pin RP100 to be Input, and maps U1RX to it
PPS_Mapping(101, _OUTPUT, _U1TX); // Sets pin RP101 to be Output, and maps U1TX to it
UART1_Init(56000); // Initialize UART module at 56000 bps
Delay_ms(100); // Wait for UART module to stabilize
I2C2_Init(100000); // Initialize I2C @ 100KHz
Delay_ms(100); // Wait to stabalize
UART1_Write_Text("Start");
UART1_Write(13);
UART1_Write(10);
while (1) { // Endless loop
SHT31_measure(); // Measure Temperature and Humidity
UART1_Write(t_m); // Display all the data received (Raw Data), except 2 CRC Bytes
UART1_Write_Text("|") ;
Delay_ms(10);
UART1_Write(t_l);
UART1_Write_Text("|") ;
delay_ms(10);
UART1_Write(h_m);
UART1_Write_Text("|") ;
delay_ms(10);
UART1_Write(h_l);
UART1_Write(13);
UART1_Write(10);
delay_ms(1000); // Wait here for a Second
}
}
posted on 2021/03/16 09:29:44 AM CET
Communication > CAN / LIN / RS485
Requesting to provide a simple C code which handles transmission and reception of FD data with different bit rate setting with Renesas MCU.
posted on 2021/02/15 11:10:40 AM CET
Please provide example for MicroC for ARM, board is Clicker 2 STM32.
Or advise which board to use with OLED
posted on 2021/02/13 05:40:31 AM CET
I've found all kinds of examples/codes in Libstock for all the hardware found on MM+ for PIC32MX7. However, I can't find anything on the site for coding a Click Board on the MM+ for PIC32MX7/Shield (mikroC Pro for PIC32).
I'm trying to use the Stepper 10 Click on the shield for bipolar motors to control metal lathes and milling machines.
User control would be through the TFT display on the MM+.
Any example of any click that interfaces through an I2C connection would be of great help.
Thanks.