kopia lustrzana https://github.com/RobertGawron/IonizationChamber
fixed uart protocol implementation and usage
rodzic
bc87a436dd
commit
679a0460fe
|
@ -12,12 +12,8 @@ logFile.write("Time,Counter\n")
|
|||
ser.flushInput()
|
||||
|
||||
while True:
|
||||
#dataIn = ser.readline().strip()
|
||||
dataIn = ser.read(4)
|
||||
|
||||
print(dataIn)
|
||||
print(len(dataIn))
|
||||
(msb, lsb) = (dataIn[1], dataIn[2])
|
||||
dataIn = ser.read(5)
|
||||
(msb, lsb) = (dataIn[2], dataIn[3])
|
||||
voltage = mcp3425.convert(msb, lsb, mcp3425.MCP3425_RESOLUTION.R14)
|
||||
now = datetime.datetime.now()
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ def convert(upperByte, lowerByte, resolution):
|
|||
return digitalToAnalog(digitalOutput, (1 * 0.01), 1)
|
||||
|
||||
if resolution == MCP3425_RESOLUTION.R13:
|
||||
return digitalToAnalog(digitalOutput, (250 * 0.000001), 1)
|
||||
return digitalToAnalog(digitalOutput, (250 * 0.0000001), 1)
|
||||
|
||||
if resolution == MCP3425_RESOLUTION.R14:
|
||||
return digitalToAnalog(digitalOutput, (62.5 * 0.00001), 1)
|
||||
return digitalToAnalog(digitalOutput, (62.5 * 0.000001), 1)
|
||||
|
||||
|
|
|
@ -32,9 +32,10 @@ void MeassurementFrame_Create(uint8_t configuration, uint16_t data)
|
|||
buffer[FRAME_CRC] = GET_CRC(configuration, data);
|
||||
}
|
||||
|
||||
|
||||
bool MeassurementFrame_Send(void (*sendFunction)(uint8_t))
|
||||
{
|
||||
for(uint8_t i=0; i< MAX_FRAME_LENGTH; i++)
|
||||
for(uint8_t i = 0; i < MAX_FRAME_LENGTH; i++)
|
||||
{
|
||||
sendFunction(buffer[i]);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ bool VoltageSensorActualValue_MeasureValue(VoltageSensorActualValue_MeasurementD
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
uint8_t VoltageSensorActualValue_GetConfiguration()
|
||||
{
|
||||
return MCP3425_CONFIGURATION;
|
||||
|
|
Ładowanie…
Reference in New Issue