Compare commits

...

3 commits

Author SHA1 Message Date
jakeg00dwin
ff8c2b48cc chagned to not use the reset pin 2024-08-26 12:03:55 -07:00
jakeg00dwin
a21e29fa94 Change in project config 2024-08-26 12:03:38 -07:00
jakeg00dwin
dc8c07ef38 MPLABX 2024-08-26 12:03:00 -07:00
3 changed files with 17 additions and 11 deletions

View file

@ -1,11 +1,11 @@
# #
#Mon Aug 26 09:45:40 PDT 2024 #Mon Aug 26 12:03:26 PDT 2024
attiny404.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=8ed9aa4326bfc0c1a849e697826741b7 attiny404.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=8ed9aa4326bfc0c1a849e697826741b7
attiny404.languagetoolchain.version=2.46 attiny404.languagetoolchain.version=2.46
attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
conf.ids=,attiny404 conf.ids=,attiny404
host.id=2ov5-ff4p-rv host.id=2ov5-ff4p-rv
configurations-xml=d7d18985d0458f138e05bddaa7c94a76 configurations-xml=242f2f04760750dac539c59b69dd7cde
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin
proj.dir=/home/ronin/Documents/projects/freelance/laith_naaman/Relay_Tester proj.dir=/home/ronin/Documents/projects/freelance/laith_naaman/Relay_Tester

View file

@ -183,7 +183,7 @@
value="ToolFirmwareOption.UseLatest"/> value="ToolFirmwareOption.UseLatest"/>
<property key="ToolFirmwareToolPack" <property key="ToolFirmwareToolPack"
value="Press to select which tool pack to use"/> value="Press to select which tool pack to use"/>
<property key="communication.activationmode" value="simplepulse"/> <property key="communication.activationmode" value="nohv"/>
<property key="communication.interface" value="updi"/> <property key="communication.interface" value="updi"/>
<property key="communication.interface.jtag" value="2wire"/> <property key="communication.interface.jtag" value="2wire"/>
<property key="communication.speed" value="0.500"/> <property key="communication.speed" value="0.500"/>
@ -247,7 +247,7 @@
value="ToolFirmwareOption.UseLatest"/> value="ToolFirmwareOption.UseLatest"/>
<property key="ToolFirmwareToolPack" <property key="ToolFirmwareToolPack"
value="Press to select which tool pack to use"/> value="Press to select which tool pack to use"/>
<property key="communication.activationmode" value="simplepulse"/> <property key="communication.activationmode" value="nohv"/>
<property key="communication.interface" value="updi"/> <property key="communication.interface" value="updi"/>
<property key="communication.interface.jtag" value="2wire"/> <property key="communication.interface.jtag" value="2wire"/>
<property key="communication.speed" value="0.500"/> <property key="communication.speed" value="0.500"/>

View file

@ -26,9 +26,10 @@
#define SW1PIN (1 << 5) #define SW1PIN (1 << 5)
#define SW2PIN (1 << 4) #define SW2PIN (1 << 4)
#define RELAYPIN (1 << 7) #define RELAYPIN (1 << 7)
#define RELAYREADINGPIN (1 << 0) // It would be better to use PA7 so USART worked #define RELAYREADINGPIN (1 << 6) // It would be better to use PA7 so USART worked
#define LED_BM_PORTA (1 << 6)|(1 << 1)|(1 << 2)|(1 << 3) //#define LED_BM_PORTA (1 << 6)|(1 << 1)|(1 << 2)|(1 << 3)
#define LED_BM_PORTA (1 << 1)|(1 << 2)|(1 << 3)
#define LED_BM_PORTB (1 << 3)|(1 << 2)|(1 << 0)|(1 << 1) #define LED_BM_PORTB (1 << 3)|(1 << 2)|(1 << 0)|(1 << 1)
// Set the function pointer for the delay func // Set the function pointer for the delay func
@ -58,7 +59,7 @@ void Deactivate_Relay(void)
void WaitForRelayConnect(void) void WaitForRelayConnect(void)
{ {
while (!(PORTB.IN & RELAYREADINGPIN)) while (!(PORTA.IN & RELAYREADINGPIN))
{ {
; ;
} }
@ -66,7 +67,7 @@ void WaitForRelayConnect(void)
void WaitForRelayDisconnect(void) void WaitForRelayDisconnect(void)
{ {
while (PORTB.IN & RELAYREADINGPIN) while (PORTA.IN & RELAYREADINGPIN)
{ {
; ;
} }
@ -107,13 +108,18 @@ void LedSetup(LedByte *led_byte)
//pin 3, bit 7, PA6 //pin 3, bit 7, PA6
led_byte->leds[7].port = &PORTA.OUT; led_byte->leds[7].port = &PORTA.OUT;
led_byte->leds[7].pin_num = 6; //led_byte->leds[7].pin_num = 6;
led_byte->leds[7].pin_num = 3;
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
//We use pin 10 which is the UDPI/RESET pin.
//This means we have to change it's mode.
PORTA.DIR |= RELAYPIN; PORTA.DIR |= RELAYPIN;
PORTB.DIR &= ~RELAYREADINGPIN; PORTA.DIR &= ~RELAYREADINGPIN;
PORTA.DIR &= ~SW1PIN; PORTA.DIR &= ~SW1PIN;
PORTA.DIR &= ~SW2PIN; PORTA.DIR &= ~SW2PIN;
@ -124,7 +130,7 @@ int main(int argc, char **argv)
LedByte led_byte = LedController_New(&PORTA.OUT); LedByte led_byte = LedController_New(&PORTA.OUT);
LedSetup(&led_byte); LedSetup(&led_byte);
//wait for a second then disable UPDI LedController_ShowByte(&led_byte, 0xAA);
while (true) while (true)
{ {