Re: MACHACC(PID)使用問題-PIC16F1614

作者 a780917a 於 2018年05月22日 16:37:24
請問MATHACC功能裡最後的數據該怎麼拿出來使用呢?

MATHACCResult MATHACC_ResultGet(void)
{
MATHACCResult data;

data.byteLL = PID1OUTLL;
data.byteLH = PID1OUTLH;
data.byteHL = PID1OUTHL;
data.byteHH = PID1OUTHH;
data.byteU = PID1OUTU;

return data;
}

我寫
unsigned long int PI_Value;

PI_Value = MATHACC_ResultGet() ;

這樣會跳出錯誤
main.c:112: error: (182) illegal conversion between types
struct S1097 -> unsigned long
main.c:112: error: (181) non-scalar types can't be converted to other types
(908) exit status = 1


BUILD FAILED (exit value 2, total time: 6s)

來自: http://www.microchip.com.tw/newbb/viewtopic.php?forum=1&topic_id=22298&post_id=78186