Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 3:4dc457ed63d5
- Parent:
- 2:03a6da61d834
- Child:
- 4:28919318b141
--- a/main.cpp Wed Dec 23 21:41:03 2020 +0000
+++ b/main.cpp Sat Mar 20 17:54:12 2021 +0000
@@ -72,6 +72,25 @@
pc1.printf("\n");
}
+
+
+void waitFrameTemp(){
+ while(!full);
+ //wait(2);
+ full=false;
+ pc1.printf("\n%d\n", rdLen);
+ for(int i = 0;i<rdLen;i++){
+ pc1.printf("%X ",recBuff[i]);
+ }
+
+
+ int voltage = recBuff[5]; //LSB
+ voltage |= (recBuff[4]) << 8; //MSB
+ double vol = voltage*0.0001907349;
+ //double vol = ((double)voltage)/65536.0 * 5.0;
+ pc1.printf("temp1 = %6.2f V\n", vol);
+
+}
void waitFrameResponse(){
while(!full);
full = false;
@@ -115,6 +134,8 @@
WriteReg(0, CONTROL2, 0x01, 1, FRMWRT_ALL_NR); //CELL_ADC_GO = 1
wait_ms(5);*/
+ bmsWakeUp = 0;
+
while (1) {
pc1.printf("Main Code \n");
@@ -124,11 +145,16 @@
wait(2);
- while(bms.readable()) bms.getc();
- int rdLen = ReadReg(0, VCELL1H , pFrame1, 6 , 0, FRMWRT_ALL_R); //12 bajtova jer cita od adrese VCELL1H po dva bajta za svaki kanal (ima 6 kanala)
+ //while(bms.readable()) bms.getc();
+ int rdLen = ReadReg(0, VCELL1H , pFrame1, 6 , 0, FRMWRT_ALL_R); //6 bajtova jer cita od adrese VCELL1H po dva bajta za svaki kanal (ima 3 kanala)
+
+
waitFrame();
+ //ReadReg(0, AUX_GPIO1H, pFrame1, 2 , 0, FRMWRT_ALL_R);
+
+ //waitFrameTemp();
//slanje zahteva za GRESKAMA