diff options
-rw-r--r-- | Arduino/main.c/main.c.ino | 108 | ||||
-rw-r--r-- | SPI.c | 2 | ||||
-rw-r--r-- | build/default/production/SPI.o | bin | 13828 -> 13816 bytes | |||
-rw-r--r-- | build/default/production/main.o | bin | 6460 -> 6464 bytes | |||
-rw-r--r-- | build/default/production/mcc_generated_files/mssp2_i2c.o | bin | 20408 -> 17456 bytes | |||
-rw-r--r-- | build/default/production/mcc_generated_files/system.o.d | 6 | ||||
-rw-r--r-- | main.c | 20 | ||||
-rw-r--r-- | nbproject/Makefile-genesis.properties | 4 | ||||
-rw-r--r-- | nbproject/configurations.xml | 6 | ||||
-rw-r--r-- | nbproject/private/private.xml | 1 | ||||
-rw-r--r-- | resbox.mc3 | 28 |
11 files changed, 113 insertions, 62 deletions
diff --git a/Arduino/main.c/main.c.ino b/Arduino/main.c/main.c.ino index 94570bc..ff5d2ee 100644 --- a/Arduino/main.c/main.c.ino +++ b/Arduino/main.c/main.c.ino @@ -5,51 +5,87 @@ double P100; double load = 0; int Q150; int Q100; + +int amongus = 0; void setup() { - Wire.begin(0x00); + Wire.begin(); Serial.begin(9600); - Serial.println("Enter Nominal System Voltage:"); - while (Serial.available() == 0){;} - VOLTAGE = Serial.parseFloat(SKIP_ALL); - Serial.print("System Voltage: "); - Serial.println(VOLTAGE, DEC); - P150 = (VOLTAGE*VOLTAGE)/150; - P100 = (VOLTAGE*VOLTAGE)/100; - Serial.println("Enter Load in kW:"); + //Serial.println("Enter Nominal System Voltage:"); + //while (Serial.available() == 0){;} + //VOLTAGE = Serial.parseFloat(SKIP_ALL); + //Serial.print("System Voltage: "); + //Serial.println(VOLTAGE, DEC); + //P150 = (VOLTAGE*VOLTAGE)/150; + //P100 = (VOLTAGE*VOLTAGE)/100; + //Serial.println("Enter Load in kW:"); + } void loop() { Serial.flush(); //while (!Serial.available()){;} - double temp = Serial.parseFloat(SKIP_ALL)*1000; + //double temp = Serial.parseFloat(SKIP_ALL)*1000; + //int temp = Serial.parseInt(SKIP_ALL); + //Serial.println(temp, DEC); + +// if((temp != load)&&(temp > 0)) +// { +// load = temp; +// if(VOLTAGE <= 500) //We don't want to use the 100ohm resistors if the voltage is higher than 500 as they would draw excessive power. +// { +// Q100 = load/P100; +// if(Q100 > 5) Q100=5; +// Q150 = (load - (Q100*P100))/P150; +// } +// else +// { +// Q150 = load/P150; +// Q100 = 0; +// } +// if(Q150 > 15) Q150 = 15; +// Serial.print("A combination of "); +// Serial.print(Q150, DEC); +// Serial.print(" 150ohm and "); +// Serial.print(Q100, DEC); +// Serial.print(" 100ohm resistors will be activated. "); +// //Serial.print(load - ((P150*Q150)+(P100*Q100)),DEC); +// Serial.print(((P150*Q150)+(P100*Q100)),DEC); +// Serial.println("W Accounted for."); +// } + + +// delay(25); +// Serial.print(amongus, DEC); +// Serial.print(" "); + Wire.requestFrom(0x30, 1); + while(Wire.available()) { + int c = Wire.read(); // Receive a byte as character + Serial.println(c); // Print the character + } + delay(100); +// + if(amongus > 32)amongus=0; +// Wire.beginTransmission(0x30); //Controller Board Has Address 0x07 +//// //Wire.write((Q150 << 3) & Q150); +// Wire.write(amongus++); +// Wire.write(150); +// Wire.endTransmission(); - if((temp != load)&&(temp > 0)) - { - load = temp; - if(VOLTAGE <= 500) //We don't want to use the 100ohm resistors if the voltage is higher than 500 as they would draw excessive power. - { - Q100 = load/P100; - if(Q100 > 5) Q100=5; - Q150 = (load - (Q100*P100))/P150; - } - else - { - Q150 = load/P150; - Q100 = 0; - } - if(Q150 > 15) Q150 = 15; - Serial.print("A combination of "); - Serial.print(Q150, DEC); - Serial.print(" 150ohm and "); - Serial.print(Q100, DEC); - Serial.print(" 100ohm resistors will be activated. "); - //Serial.print(load - ((P150*Q150)+(P100*Q100)),DEC); - Serial.print(((P150*Q150)+(P100*Q100)),DEC); - Serial.println("W Accounted for."); - } - Wire.beginTransmission(0x01); //Controller Board Has Address 0x01 - Wire.write((Q150 << 3) & Q150); + //for(int x = 0; x <32;x++){ + delay(5); + amongus++; + //Serial.print("Increment Value"); + //Serial.println(amongus); + Wire.beginTransmission(0x30); //Controller Board Has Address 0x07 + //Wire.write((Q150 << 3) & Q150); + Wire.write(amongus); + //Wire.write(amongus); Wire.endTransmission(); + delay(50); +// Wire.beginTransmission(0x30); //Controller Board Has Address 0x07 +// //Wire.write((Q150 << 3) & Q150); +// //Wire.write(amongus); +// Wire.endTransmission(); } @@ -34,7 +34,7 @@ WriteBuffer[0] = WriteBuffer[2] = WriteBuffer[4] = 0b10000000; WriteBuffer[1] = (0xFF << Ohm_150) ^ (0xFF); WriteBuffer[3] = (0xFF << (Ohm_150 - 8)) ^ (0xFF); - WriteBuffer[5] = (0xFF << (Ohm_68 - 4)) ^ (0xFF) | (testLED << 8); + WriteBuffer[5] = (0xFF << (Ohm_68 - 4)) ^ (0xFF) | testLED; //if (Ohm_68 == 5) WriteBuffer[3]|= 0b10000000; readData = MSSP1_SPI_Exchange8bitBuffer(WriteBuffer, 6, ReadBuffer); } diff --git a/build/default/production/SPI.o b/build/default/production/SPI.o Binary files differindex 4cbb2df..6b7cfb6 100644 --- a/build/default/production/SPI.o +++ b/build/default/production/SPI.o diff --git a/build/default/production/main.o b/build/default/production/main.o Binary files differindex a794a16..ca480ed 100644 --- a/build/default/production/main.o +++ b/build/default/production/main.o diff --git a/build/default/production/mcc_generated_files/mssp2_i2c.o b/build/default/production/mcc_generated_files/mssp2_i2c.o Binary files differindex 3b6846c..c9b3a3f 100644 --- a/build/default/production/mcc_generated_files/mssp2_i2c.o +++ b/build/default/production/mcc_generated_files/mssp2_i2c.o diff --git a/build/default/production/mcc_generated_files/system.o.d b/build/default/production/mcc_generated_files/system.o.d index 53c3ba4..e35c712 100644 --- a/build/default/production/mcc_generated_files/system.o.d +++ b/build/default/production/mcc_generated_files/system.o.d @@ -2,7 +2,7 @@ build/default/production/mcc_generated_files/system.o: \ mcc_generated_files/system.c mcc_generated_files/pin_manager.h \ mcc_generated_files/clock.h mcc_generated_files/system.h \ mcc_generated_files/interrupt_manager.h mcc_generated_files/traps.h \ - mcc_generated_files/mssp2_i2c.h mcc_generated_files/mssp1_spi.h + mcc_generated_files/mssp1_spi.h mcc_generated_files/mssp2_i2c.h mcc_generated_files/pin_manager.h: @@ -14,6 +14,6 @@ mcc_generated_files/interrupt_manager.h: mcc_generated_files/traps.h: -mcc_generated_files/mssp2_i2c.h: - mcc_generated_files/mssp1_spi.h: + +mcc_generated_files/mssp2_i2c.h: @@ -48,6 +48,7 @@ #include "mcc_generated_files/system.h"
#include "SPI.h"
+
/*
Main application
*/
@@ -65,16 +66,23 @@ int main(void) Message_HWCR(nullarray);
SPI_slaveDeselect();
- _LATB6 = 0;
+ _LATB6 = 1;
_LATB7 = 1;
_LATB8 = 1;
+ //MSSP2_I2C_ReadPointerSet(0b00000011);
+ // MSSP2_I2C_WritePointerSet(0x00);
+ uint8_t *buffer;
+ uint8_t *status;
+
while (1)
{
- SPI_slaveSelect();
- Message_OUT(15, 5, 0);
- SPI_slaveDeselect();
+ //MSSP2_I2C_ReadPointerSet(0b00000011);
+ //MSSP2_I2C_ReadPointerSet(0b00000011);
+ //SPI_slaveSelect();
+ //Message_OUT(15, 5, 0);
+ //SPI_slaveDeselect();
/*
SPI_slaveSelect();
Message_OUT(15, 5, 0);
@@ -87,7 +95,11 @@ int main(void) SPI_slaveSelect();
Message_OUT(15, 5, 0);
SPI_slaveDeselect();
+ *
+ *
*/
+ //if(MSSP2_I2C_WritePointerGet() > 50) {_LATB7 = 0; _LATB6 = 1;}
+ //else {_LATB6 = 0; _LATB7 = 1;}
}
return 1;
diff --git a/nbproject/Makefile-genesis.properties b/nbproject/Makefile-genesis.properties index 0f3374c..c077836 100644 --- a/nbproject/Makefile-genesis.properties +++ b/nbproject/Makefile-genesis.properties @@ -1,11 +1,11 @@ # -#Wed Mar 06 04:10:54 CST 2024 +#Sun Mar 10 13:59:42 CDT 2024 default.languagetoolchain.version=2.10 default.Pack.dfplocation=/opt/microchip/mplabx/v6.15/packs/Microchip/PIC24F-KA-KL-KM_DFP/1.4.83 conf.ids=default default.languagetoolchain.dir=/opt/microchip/xc16/v2.10/bin host.id=2oqs-k23c-b5 -configurations-xml=aae6a2fa6b09eec831650b355357fe0b +configurations-xml=8813fd3bc32c7d8cfcf5d0752129c2eb com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=e62346c0c0ecee2637e613b49cb7b7fa proj.dir=/home/josh/MPLABXProjects/resbox.X default.com-microchip-mplab-mdbcore-pk4hybrid-Pk4HybridTooImpl.md5=38058ec39ea8224adcc766836376f0d6 diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 87b477f..6dcfa92 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -771,7 +771,7 @@ <property key="periphComp4.gte" value="gt"/> <property key="periphComp5.gte" value="gt"/> <property key="periphComp6.gte" value="gt"/> - <property key="poweroptions.powerenable" value="true"/> + <property key="poweroptions.powerenable" value="false"/> <property key="programmerToGoFilePath" value="/home/josh/MPLABXProjects/resbox.X/debug/default/resbox_ptg"/> <property key="programmerToGoImageName" value="resbox_ptg"/> @@ -1302,7 +1302,9 @@ value="${memories.instruction.ram.ranges}"/> <property key="memories.programmemory" value="true"/> <property key="memories.programmemory.ranges" value="0-2bff"/> - <property key="poweroptions.powerenable" value="true"/> + <property key="poweroptions.powerenable" value="false"/> + <property key="programmerToGoFilePath" + value="/home/josh/MPLABXProjects/resbox.X/debug/default/resbox_ptg"/> <property key="programmerToGoImageName" value="resbox_ptg"/> <property key="programoptions.donoteraseauxmem" value="false"/> <property key="programoptions.eraseb4program" value="true"/> diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 9c9abde..3a23776 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -7,6 +7,7 @@ <file>file:/home/josh/MPLABXProjects/resbox.X/mcc_generated_files/mssp2_i2c.h</file> <file>file:/home/josh/MPLABXProjects/resbox.X/mcc_generated_files/clock.h</file> <file>file:/home/josh/MPLABXProjects/resbox.X/mcc_generated_files/mssp1_spi.c</file> + <file>file:/home/josh/MPLABXProjects/resbox.X/mcc_generated_files/interrupt_manager.c</file> <file>file:/home/josh/MPLABXProjects/resbox.X/mcc_generated_files/clock.c</file> <file>file:/home/josh/MPLABXProjects/resbox.X/mcc_generated_files/pin_manager.c</file> <file>file:/home/josh/MPLABXProjects/resbox.X/mcc_generated_files/mssp1_spi.h</file> @@ -256,7 +256,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="INTERNAL OSCILLATOR" name="FrcEnable"/> - <value>enabled</value> + <value>disabled</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="INTERNAL OSCILLATOR" name="FrcPostscaler"/> @@ -264,7 +264,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="INTERNAL OSCILLATOR" name="FrcPostscalerClock"/> - <value>8000000</value> + <value/> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="INTERNAL OSCILLATOR" name="OSCPinsInput"/> @@ -1732,7 +1732,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="MSSP2" name="ClockFrequency"/> - <value>1.0E+7</value> + <value>100000</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="MSSP2" name="MSSP2_BCLIISRFunction"/> @@ -2068,7 +2068,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="MSSP2" registerAlias="SSPADD"/> - <value>1</value> + <value>7</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="MSSP2" registerAlias="SSPBUF"/> @@ -2080,11 +2080,11 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="MSSP2" registerAlias="SSPCON2"/> - <value>0</value> + <value>1</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="MSSP2" registerAlias="SSPCON3"/> - <value>0</value> + <value>24</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="MSSP2" registerAlias="SSPMSK"/> @@ -2112,7 +2112,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPADD" settingAlias="SSPADD"/> - <value>1</value> + <value>7</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPBUF" settingAlias="SSPBUF"/> @@ -2168,7 +2168,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPCON2" settingAlias="SEN"/> - <value>disabled</value> + <value>enabled</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPCON3" settingAlias="ACKTIM"/> @@ -2180,7 +2180,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPCON3" settingAlias="BOEN"/> - <value>disabled</value> + <value>enabled</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPCON3" settingAlias="DHEN"/> @@ -2200,7 +2200,7 @@ </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPCON3" settingAlias="SDAHT"/> - <value>100ns</value> + <value>300ns</value> </entry> <entry> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="MSSP2" registerAlias="SSPI" settingAlias="context"/> @@ -5474,7 +5474,7 @@ </entry> <entry> <file>mcc_generated_files/system.c</file> - <hash>4d49f0a71be32f17d0d14b686e7af8105d0e99bb192dadc9609cd1c336026801</hash> + <hash>f1ce360d9a65aac3ed5e8125fd5cb2fed2cf5b7c2ca00e74ac1869246ea11526</hash> </entry> <entry> <file>mcc_generated_files/mssp1_spi.h</file> @@ -5498,15 +5498,15 @@ </entry> <entry> <file>mcc_generated_files/mssp2_i2c.c</file> - <hash>dd2f9baba6f9880e8b37a0c4eff07e4be8de9b3a48e1ccd447e439c8481a8f7d</hash> + <hash>6e7ff380be6bfa8569ce806b04616f042f51a41c2e06f4c339035a06136ba6ed</hash> </entry> <entry> <file>mcc_generated_files/mssp2_i2c.h</file> - <hash>3fc51aebe7ec98f964f309eb08406ffec483b5e2f717e15f0bd1edce5f2fee3f</hash> + <hash>f5c84331b873ea4ceec9269263d2a30d0cecd046dd89d75a2893edba9af2bf4c</hash> </entry> <entry> <file>mcc_generated_files/mcc.h</file> - <hash>5138be3f7a497246c6f3b9216563623cac5b138c2d3e3604911cf70d29649c40</hash> + <hash>da821ef996a6cff2ed80d33c9a57879210ca8d62a6dd2fd963a1877dc71a32fa</hash> </entry> <entry> <file>mcc_generated_files/system.h</file> |