4th Semseter files
This commit is contained in:
17
4th-Semester-Spring-2023/Embedded/MSP-Testing/.vscode/c_cpp_properties.json
vendored
Executable file
17
4th-Semester-Spring-2023/Embedded/MSP-Testing/.vscode/c_cpp_properties.json
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${$HOME}/ti/"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/bin/gcc",
|
||||
"cStandard": "gnu17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
28
4th-Semester-Spring-2023/Embedded/MSP-Testing/Makefile
Executable file
28
4th-Semester-Spring-2023/Embedded/MSP-Testing/Makefile
Executable file
@@ -0,0 +1,28 @@
|
||||
ifndef $(MSPGCCDIR)
|
||||
MSPGCCDIR=$(HOME)/ti/msp430-gcc
|
||||
endif
|
||||
#paths
|
||||
INCLUDES_DIRECTORY = $(MSPGCCDIR)/include
|
||||
|
||||
DEVICE = msp430fr2355
|
||||
|
||||
# compiler options
|
||||
CC=$(MSPGCCDIR)/bin/msp430-elf-gcc
|
||||
|
||||
CFLAGS = -I . -I $(INCLUDES_DIRECTORY) -mmcu=$(DEVICE) -g -mhwmult=f5series
|
||||
LFLAGS = -L . -L $(INCLUDES_DIRECTORY)
|
||||
|
||||
# mspdebug driver -- used for installation
|
||||
DRIVER:= tilib
|
||||
|
||||
# Compiling
|
||||
all: main.elf
|
||||
|
||||
%.elf : %.c
|
||||
$(CC) $(CFLAGS) $(LFLAGS) $< -o $@
|
||||
|
||||
install: main.elf
|
||||
mspdebug $(DRIVER) "prog $<" --allow-fw-update
|
||||
|
||||
clean:
|
||||
rm -f *.o *.elf
|
||||
31
4th-Semester-Spring-2023/Embedded/MSP-Testing/main.c
Executable file
31
4th-Semester-Spring-2023/Embedded/MSP-Testing/main.c
Executable file
@@ -0,0 +1,31 @@
|
||||
#include <msp430fr2355.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
// half a second at 1Mhz
|
||||
#define BLINK_CYCLES 2000000L
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// stop watchdog timer
|
||||
WDTCTL = WDTPW | WDTHOLD;
|
||||
|
||||
// allow changes to port registers
|
||||
PM5CTL0 &= ~LOCKLPM5;
|
||||
|
||||
P1DIR |= BIT0; // set pin 1.0 as output
|
||||
P1OUT &= ~BIT0; // clear pin 1.0 (make it low)
|
||||
|
||||
P4DIR |= BIT0; // set pin 4.6 as output
|
||||
P4OUT |= BIT6; // set pin 4.6 (make it high)
|
||||
|
||||
while (true)
|
||||
{
|
||||
__delay_cycles(BLINK_CYCLES);
|
||||
P1OUT ^= BIT0; // toggle pin 1.0
|
||||
P4OUT ^= BIT6; // toggle pin 4.6
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
BIN
4th-Semester-Spring-2023/Embedded/MSP-Testing/main.elf
Executable file
BIN
4th-Semester-Spring-2023/Embedded/MSP-Testing/main.elf
Executable file
Binary file not shown.
Reference in New Issue
Block a user