How to solve "File: first.m Line: 1 Column: 1 Invalid use of operator" error?

15 visualizaciones (últimos 30 días)
/******************************************************************************* Program for, "DHT11 interfacing with PIC16F877A" Program written by_ Engr. Mithun K. Das MCU: PIC16F877A; X-tal: 8MHz; mikroC pro for PIC v7.6.0 Date: 15-05-2020 *****************************************************************************/
// LCD module connections sbit LCD_RS at RB2_bit; sbit LCD_EN at RB3_bit; sbit LCD_D4 at RB4_bit; sbit LCD_D5 at RB5_bit; sbit LCD_D6 at RB6_bit; sbit LCD_D7 at RB7_bit; sbit LCD_RS_Direction at TRISB2_bit; sbit LCD_EN_Direction at TRISB3_bit; sbit LCD_D4_Direction at TRISB4_bit; sbit LCD_D5_Direction at TRISB5_bit; sbit LCD_D6_Direction at TRISB6_bit; sbit LCD_D7_Direction at TRISB7_bit; // END of LCD initialization
// DHT22 pin connection (here data pin is connected to pin RB0) #define DHT22_PIN RB1_bit #define DHT22_PIN_DIR TRISB1_bit
#include stdint.h
// read one byte from sensor uint8_t dht22_read_byte() { uint8_t i = 8, dht22_byte = 0;
while(i--)
{
while( !DHT22_PIN );
Delay_us(40);
if( DHT22_PIN )
{
dht22_byte |= (1 << i); // set bit i
while( DHT22_PIN );
}
}
return(dht22_byte);
}
// read humidity (in hundredths rH%) and temperature (in hundredths °Celsius) from sensor void dht22_read(uint16_t *dht22_humi, int16_t *dht22_temp) { // send start signal DHT22_PIN = 0; // connection pin output low DHT22_PIN_DIR = 0; // configure connection pin as output Delay_ms(25);

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de Oct. de 2021
That is C code. It cannot be run directly from MATLAB.
To call it from MATLAB, you would need to compile it, and then use loadlibrary() to access it.
However, that code is designed for running on PIC16F877A and so even if you manage to compile it and call it from MATLAB, it will not do anything useful. It is intended to be compiled and run on PIC16F877A directly as a function called by something else running on the PIC16F877A

Más respuestas (0)

Categorías

Más información sobre External Language Interfaces en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by