Libstock prefers package manager

Package Manager

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]

Sort By

USER REQUESTS

first | 1 | 2 next >>
Rainer Hantsch
rainer

posted on 2019/08/28 11:07:46 AM CEST

Click Boards > Miscellaneous

Inter-Task communication for CRTOS on PIC18 controllers in mikroPascal language?

Hello.
Since a short time I use CRTOS with mikroPascal PRO for PIC. I use PIC18 controllers.

What I miss in CRTOS is messaging. One task shall i.e. do the serial I/O. Other tasks tell this one task what to send (a string), so I can prevent any collisions. Also, this one task can receive and dispatch /forward incoming data to particular other tasks.

Such things work best with message pipes (N-to-1 and 1-to-N pipes).

Is something like this already available?

Asa Muna
asa

posted on 2019/08/22 05:44:51 PM CEST

Click Boards

RTD Click to DAC Click

I am using PIC18F45k22, RTD Click and DAC Click. I managed to execute the example code successfully on EasyPIC7 board. Now my aim is to merge the two example code and pass the RTD value (0-250) to DAC click (0-4095), so that I can have RTD reading in terms of a Voltage output. PIC18F45k22 act as the master to relay this operation.
To begin with, I merged ADC click and DAC click and it worked well.

however, when when I merge RTD and DAC, RTD does not seem to give me correct temperature reading. Code below is the RTD Click example with DAC click header includes and also microbus2 definition under systemInit(). This prints wrong temperature readings (way off the expected values). once I remove the microbus2 definition, it works well.

Could you please help on this

#include "Click_RTD_types.h"
#include "Click_RTD_config.h"

#include "Click_DAC_types.h"
#include "Click_DAC_config.h"

void systemInit()
{
mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_CS_PIN, _GPIO_OUTPUT );
mikrobus_spiInit( _MIKROBUS1, &_RTD_SPI_CFG[0] );

mikrobus_gpioInit( _MIKROBUS2, _MIKROBUS_CS_PIN, _GPIO_OUTPUT );
mikrobus_spiInit( _MIKROBUS2, &_DAC_SPI_CFG[0] );

mikrobus_logInit( _LOG_USBUART, 9600 );

Delay_ms( 100 );
}

void applicationInit()
{
rtd_spiDriverInit( (T_RTD_P)&_MIKROBUS1_GPIO, (T_RTD_P)&_MIKROBUS1_SPI );
rtd_writeRegister(_RTD_CONFIGURATION, 0xD0);
}

void applicationTask()
{
uint16_t readValue;
float convertedValue;
char testTxt [20];
char testTxt1 [20];

readValue = rtd_readTemperature();
convertedValue = rtd_convertTemperature(readValue, _RTD_REF_RESISTANCE_470);

floatToStr(readValue, testTxt1);
floatToStr(convertedValue, testTxt);
mikrobus_logWrite("Current temperature: ", _LOG_TEXT );
mikrobus_logWrite(testTxt, _LOG_LINE );
mikrobus_logWrite("Voltage: ", _LOG_TEXT );
mikrobus_logWrite(testTxt1, _LOG_LINE );
delay_ms(800);
}

void main()
{
systemInit();
applicationInit();

while (1)
{
applicationTask();
}
}

first | 1 | 2 next >>