Added HCMS Module

It will be made a static library later, this is just for function. Will clean up dirt later.
This commit is contained in:
Burhan Topaloglu
2024-03-06 16:28:06 +01:00
parent 98d911a472
commit db13902e03
18 changed files with 564 additions and 148 deletions

View File

@@ -19,7 +19,7 @@ endif
endif
# Environment
MKDIR=gnumkdir -p
MKDIR=mkdir -p
RM=rm -f
MV=mv
CP=cp
@@ -92,7 +92,7 @@ ${OBJECTDIR}/picamp-potentiometer.p1: picamp-potentiometer.c nbproject/Makefile
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/picamp-potentiometer.p1.d
@${RM} ${OBJECTDIR}/picamp-potentiometer.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=none -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-potentiometer.p1 picamp-potentiometer.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=none -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-potentiometer.p1 picamp-potentiometer.c
@-${MV} ${OBJECTDIR}/picamp-potentiometer.d ${OBJECTDIR}/picamp-potentiometer.p1.d
@${FIXDEPS} ${OBJECTDIR}/picamp-potentiometer.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
@@ -101,7 +101,7 @@ ${OBJECTDIR}/picamp-potentiometer.p1: picamp-potentiometer.c nbproject/Makefile
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/picamp-potentiometer.p1.d
@${RM} ${OBJECTDIR}/picamp-potentiometer.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-potentiometer.p1 picamp-potentiometer.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-potentiometer.p1 picamp-potentiometer.c
@-${MV} ${OBJECTDIR}/picamp-potentiometer.d ${OBJECTDIR}/picamp-potentiometer.p1.d
@${FIXDEPS} ${OBJECTDIR}/picamp-potentiometer.p1.d $(SILENT) -rsi ${MP_CC_DIR}../

View File

@@ -1,13 +1,13 @@
#
#Wed Mar 06 12:04:54 CET 2024
default.languagetoolchain.version=2.45
default.Pack.dfplocation=C\:\\Program Files\\Microchip\\MPLABX\\v6.15\\packs\\Microchip\\PIC16Fxxx_DFP\\1.4.149
#Wed Mar 06 15:56:03 CET 2024
default.languagetoolchain.version=2.46
default.Pack.dfplocation=
conf.ids=default
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc8\\v2.45\\bin
host.id=2cdp-lqgb-i2
default.languagetoolchain.dir=/home/burhan/.local/share/microchip/xc8/v2.46/bin
host.id=1odb-89vf-4o
default.platformTool.md5=null
configurations-xml=ef0dab023007462dba333f99adb47e89
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=e62346c0c0ecee2637e613b49cb7b7fa
default.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=486b02ed36e5bdffb1f797e38fa058e5
proj.dir=C\:\\Users\\wesse\\Downloads\\PICAMP-bbcdff189bdb53bccc968032c5cc010f25c24f1c\\picamp-potentiometer.X
host.platform=windows
configurations-xml=f54ead1af12c297ec1625d582980ea99
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
default.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
proj.dir=/home/burhan/Desktop/PICAMP-main/picamp-potentiometer.X
host.platform=linux

View File

@@ -14,24 +14,22 @@
# You can invoke make with the values of the macros:
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/
PATH_TO_IDE_BIN=/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
PATH:=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
PATH:=/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.15\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/"
MP_JAVA_PATH="/home/burhan/.local/share/microchip/mplabx/v6.20/sys/java/zulu8.64.0.19-ca-fx-jre8.0.345-linux_x64/bin/"
OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_CC="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
# MP_CPPC is not defined
# MP_BC is not defined
MP_AS="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_LD="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_AR="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-ar.exe"
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_AS="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
MP_LD="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
MP_AR="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-ar"
DEP_GEN=${MP_JAVA_PATH}java -jar "/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
# MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined
MP_AS_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_LD_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_AR_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
DFP_DIR=C:/Program Files/Microchip/MPLABX/v6.15/packs/Microchip/PIC16Fxxx_DFP/1.4.149
MP_AS_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
MP_LD_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
MP_AR_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"

View File

@@ -19,7 +19,7 @@ endif
endif
# Environment
MKDIR=gnumkdir -p
MKDIR=mkdir -p
RM=rm -f
MV=mv
CP=cp
@@ -92,7 +92,7 @@ ${OBJECTDIR}/picamp-rotary.p1: picamp-rotary.c nbproject/Makefile-${CND_CONF}.m
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/picamp-rotary.p1.d
@${RM} ${OBJECTDIR}/picamp-rotary.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=none -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-rotary.p1 picamp-rotary.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=none -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-rotary.p1 picamp-rotary.c
@-${MV} ${OBJECTDIR}/picamp-rotary.d ${OBJECTDIR}/picamp-rotary.p1.d
@${FIXDEPS} ${OBJECTDIR}/picamp-rotary.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
@@ -101,7 +101,7 @@ ${OBJECTDIR}/picamp-rotary.p1: picamp-rotary.c nbproject/Makefile-${CND_CONF}.m
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/picamp-rotary.p1.d
@${RM} ${OBJECTDIR}/picamp-rotary.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-rotary.p1 picamp-rotary.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/picamp-rotary.p1 picamp-rotary.c
@-${MV} ${OBJECTDIR}/picamp-rotary.d ${OBJECTDIR}/picamp-rotary.p1.d
@${FIXDEPS} ${OBJECTDIR}/picamp-rotary.p1.d $(SILENT) -rsi ${MP_CC_DIR}../

View File

@@ -1,13 +1,13 @@
#
#Wed Mar 06 12:04:57 CET 2024
default.languagetoolchain.version=2.45
default.Pack.dfplocation=C\:\\Program Files\\Microchip\\MPLABX\\v6.15\\packs\\Microchip\\PIC16Fxxx_DFP\\1.4.149
#Wed Mar 06 15:56:01 CET 2024
default.languagetoolchain.version=2.46
default.Pack.dfplocation=
conf.ids=default
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc8\\v2.45\\bin
host.id=2cdp-lqgb-i2
default.languagetoolchain.dir=/home/burhan/.local/share/microchip/xc8/v2.46/bin
host.id=1odb-89vf-4o
default.platformTool.md5=null
configurations-xml=43b07172340b3eaea269a3aff96aed06
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=e62346c0c0ecee2637e613b49cb7b7fa
default.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=486b02ed36e5bdffb1f797e38fa058e5
proj.dir=C\:\\Users\\wesse\\Downloads\\PICAMP-bbcdff189bdb53bccc968032c5cc010f25c24f1c\\picamp-rotary.X
host.platform=windows
configurations-xml=897136f155860b209772fd08ad017bce
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
default.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
proj.dir=/home/burhan/Desktop/PICAMP-main/picamp-rotary.X
host.platform=linux

View File

@@ -14,24 +14,22 @@
# You can invoke make with the values of the macros:
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/
PATH_TO_IDE_BIN=/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
PATH:=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
PATH:=/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.15\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/"
MP_JAVA_PATH="/home/burhan/.local/share/microchip/mplabx/v6.20/sys/java/zulu8.64.0.19-ca-fx-jre8.0.345-linux_x64/bin/"
OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_CC="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
# MP_CPPC is not defined
# MP_BC is not defined
MP_AS="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_LD="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_AR="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-ar.exe"
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_AS="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
MP_LD="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
MP_AR="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-ar"
DEP_GEN=${MP_JAVA_PATH}java -jar "/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
# MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined
MP_AS_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_LD_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_AR_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
DFP_DIR=C:/Program Files/Microchip/MPLABX/v6.15/packs/Microchip/PIC16Fxxx_DFP/1.4.149
MP_AS_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
MP_LD_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
MP_AR_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"

View File

@@ -0,0 +1,45 @@
#ifndef HCMS2913_H
#define HCMS2913_H
#include "./HCMS2913.h"
#include "./config.h"
typedef enum {
MST_OSC_DIV_04, // 0x0: 0000
MST_OSC_DIV_16, // 0x1: 0001
MST_OSC_DIV_64, // 0x2: 0010
MST_OSC_DIV_T2, // 0x3: 0011
SLV_SS_EN, // 0x4: 0100 - not used in this version of our lib ...
SLV_SS_DIS // 0x5: 0101
} sspmode;
// Datasheet SMP (Sample Timing) behavior in (SPI MASTER MODE ONLY):
// 1 = Input data sampled (received) at end of data output time
// 0 = Input data sampled (recieved) at middle of data output time
typedef enum {
SMP0_SDI_MIDDLE, SMP1_SDI_END
} rxsmpmoment;
// Datasheet CKP (Clock Polarity) select bit behavior (SPI mode):
// 1 = Idle state for clock is a high level
// 0 = Idle state for clock is a low level
typedef enum {
CKP0_CPOL0_IDLE_LOW, CKP1_CPOL1_IDLE_HIGH
} clkpol;
// Datasheet CKE (Clock Edge) select bit behavior (SPI mode):
// 1 = Transmit occurs on transition from active to Idle clock state
// 0 = Transmit occurs on transition from Idle to active clock state
// ! NOTE: Microchip CKE bit is always the inverse of Motorola CPHA bit!
typedef enum {
CKE0_CPHA1_TRSMIT_IDL2ACT, CKE1_CPHA0_TRSMIT_ACT2IDL
} txclkedge;
void HCMS_init(volatile unsigned char *port, uint8_t _RESET, uint8_t _CENABLE, uint8_t _RSELECT);
void HCMS_load_word(const char *_string, char *bufferSelected, volatile unsigned char *port, uint8_t _CENABLE);
void HCMS_spi_init(sspmode mst_slv_oscdiv, rxsmpmoment sdi_rx_smp, clkpol clock_pol, txclkedge sdo_tx_edge);
#endif

151
picamp.X/include/ascii.h Executable file
View File

@@ -0,0 +1,151 @@
#ifndef ASCII_H
#define ASCII_H
// characters taken from "HCMS-29xx/HCMS-39xx LED Displays Character Set (ASCII and Katakana)"
// cherry picked and ordered by Burhan Topaloglu
// item 6 is for lookup.
const char ascii[128][6] = {
// debug
{0x00, 0x00, 0x00, 0x00, 0x00, ' '}, // 0 space/empty
{0x2A, 0x55, 0x2A, 0x55, 0x2A, 0xD7}, // 1 checker, using the ascii for x cross
// numbers
{0x3E, 0x51, 0x49, 0x45, 0x3E, '0'}, // 2 0
{0x00, 0x42, 0x7F, 0x40, 0x00, '1'}, // 3 1
{0x62, 0x51, 0x49, 0x49, 0x46, '2'}, // 4 2
{0x22, 0x41, 0x49, 0x49, 0x36, '3'}, // 5 3
{0x18, 0x14, 0x12, 0x7F, 0x10, '4'}, // 6 4
{0x27, 0x45, 0x45, 0x45, 0x39, '5'}, // 7 5
{0x3C, 0x4A, 0x49, 0x49, 0x30, '6'}, // 8 6
{0x01, 0x71, 0x09, 0x05, 0x03, '7'}, // 9 7
{0x36, 0x49, 0x49, 0x49, 0x37, '8'}, // 10 8
{0x06, 0x49, 0x49, 0x29, 0x1E, '9'}, // 11 9
// lowercase letters
{0x38, 0x44, 0x44, 0x3C, 0x40, 'a'}, // 12 a
{0x7F, 0x48, 0x44, 0x44, 0x38, 'b'}, // 13 b
{0x38, 0x44, 0x44, 0x44, 0x44, 'c'}, // 14 c
{0x38, 0x44, 0x44, 0x48, 0x7F, 'd'}, // 15 d
{0x38, 0x54, 0x54, 0x54, 0x08, 'e'}, // 16 e
{0x08, 0x7E, 0x09, 0x02, 0x00, 'f'}, // 17 f
{0x08, 0x14, 0x54, 0x54, 0x3C, 'g'}, // 18 g
{0x7F, 0x08, 0x04, 0x04, 0x78, 'h'}, // 19 h
{0x00, 0x44, 0x7D, 0x40, 0x00, 'i'}, // 20 i
{0x20, 0x40, 0x44, 0x3D, 0x00, 'j'}, // 21 j
{0x00, 0x7F, 0x10, 0x28, 0x44, 'k'}, // 22 k
{0x00, 0x41, 0x7F, 0x40, 0x00, 'l'}, // 23 l
{0x78, 0x04, 0x18, 0x04, 0x78, 'm'}, // 24 m
{0x7C, 0x08, 0x04, 0x04, 0x78, 'n'}, // 25 n
{0x38, 0x44, 0x44, 0x44, 0x38, 'o'}, // 26 o
{0x7C, 0x14, 0x24, 0x24, 0x18, 'p'}, // 27 p
{0x18, 0x24, 0x14, 0x7C, 0x40, 'q'}, // 28 q
{0x00, 0x7C, 0x08, 0x04, 0x04, 'r'}, // 29 r
{0x48, 0x54, 0x54, 0x54, 0x20, 's'}, // 30 s
{0x04, 0x3E, 0x44, 0x20, 0x00, 't'}, // 31 t
{0x3C, 0x40, 0x40, 0x20, 0x7C, 'u'}, // 32 u
{0x1C, 0x20, 0x40, 0x20, 0x1C, 'v'}, // 33 v
{0x3C, 0x40, 0x30, 0x40, 0x3C, 'w'}, // 34 w
{0x44, 0x28, 0x10, 0x28, 0x44, 'x'}, // 35 x
{0x04, 0x48, 0x30, 0x08, 0x04, 'y'}, // 36 y
{0x44, 0x64, 0x54, 0x4C, 0x44, 'z'}, // 37 z
// uppercase letters
{0x7E, 0x09, 0x09, 0x09, 0x7E, 'A'}, // 38 A
{0x7E, 0x49, 0x49, 0x49, 0x36, 'B'}, // 39 B
{0x3E, 0x41, 0x41, 0x41, 0x22, 'C'}, // 40 C
{0x7F, 0x41, 0x41, 0x41, 0x3E, 'D'}, // 41 D
{0x7F, 0x49, 0x49, 0x49, 0x41, 'E'}, // 42 E
{0x7F, 0x09, 0x09, 0x09, 0x01, 'F'}, // 43 F
{0x3E, 0x41, 0x41, 0x51, 0x32, 'G'}, // 44 G
{0x7F, 0x08, 0x08, 0x08, 0x7F, 'H'}, // 45 H
{0x00, 0x41, 0x7F, 0x41, 0x00, 'I'}, // 46 I
{0x20, 0x40, 0x40, 0x40, 0x3F, 'J'}, // 47 J
{0x7F, 0x08, 0x14, 0x22, 0x41, 'K'}, // 48 K
{0x7F, 0x40, 0x40, 0x40, 0x40, 'L'}, // 49 L
{0x7F, 0x02, 0x0C, 0x02, 0x7F, 'M'}, // 50 M
{0x7F, 0x04, 0x08, 0x10, 0x7F, 'N'}, // 51 N
{0x3E, 0x41, 0x41, 0x41, 0x3E, 'O'}, // 52 O
{0x7F, 0x09, 0x09, 0x09, 0x06, 'P'}, // 53 P
{0x3E, 0x41, 0x51, 0x21, 0x5E, 'Q'}, // 54 Q
{0x7F, 0x09, 0x19, 0x29, 0x46, 'R'}, // 55 R
{0x26, 0x49, 0x49, 0x49, 0x32, 'S'}, // 56 S
{0x01, 0x01, 0x7F, 0x01, 0x01, 'T'}, // 57 T
{0x3F, 0x40, 0x40, 0x40, 0x3F, 'U'}, // 58 U
{0x07, 0x18, 0x60, 0x18, 0x07, 'V'}, // 59 V
{0x7F, 0x20, 0x18, 0x20, 0x7F, 'W'}, // 60 W
{0x63, 0x14, 0x08, 0x14, 0x63, 'X'}, // 61 X
{0x03, 0x04, 0x78, 0x04, 0x03, 'Y'}, // 62 Y
{0x61, 0x51, 0x49, 0x45, 0x43, 'Z'}, // 63 Z
// special letters/umlauts
{0x78, 0x14, 0x15, 0x14, 0x78, 0xC5}, // 64 <20> capital A with circle on top
{0x38, 0x44, 0x45, 0x3C, 0x40, 0xE5}, // 65 <20> lowercase a with circle on top
{0x78, 0x15, 0x14, 0x15, 0x78, 0xC4}, // 66 <20> capital A with two dots on top
{0x38, 0x45, 0x44, 0x3D, 0x40, 0xE4}, // 67 <20> lowercase a with two dots on top
{0x3C, 0x43, 0x42, 0x43, 0x3C, 0xD6}, // 68 <20> capital O with two dots on top
{0x38, 0x45, 0x44, 0x45, 0x38, 0xF6}, // 69 <20> lowercase o with two dots on top
{0x3C, 0x41, 0x40, 0x41, 0x3C, 0xDC}, // 70 <20> capital U with two dots on top
{0x38, 0x42, 0x40, 0x42, 0x38, 0xFC}, // 71 <20> lowercase u with two dots on top
// special characters
{0x00, 0x00, 0x5F, 0x00, 0x00, '!'}, // 72 !
{0x00, 0x03, 0x00, 0x03, 0x00, '"'}, // 73 "
{0x14, 0x7F, 0x14, 0x7F, 0x14, '#'}, // 74 #
{0x24, 0x2A, 0x7F, 0x2A, 0x12, '$'}, // 75 $
{0x23, 0x13, 0x08, 0x64, 0x62, '%'}, // 76 %
{0x36, 0x49, 0x56, 0x20, 0x50, '&'}, // 77 &
{0x00, 0x0B, 0x07, 0x00, 0x00, 0x27}, // 78 '
{0x00, 0x00, 0x3E, 0x41, 0x00, '('}, // 79 (
{0x00, 0x41, 0x3E, 0x00, 0x00, ')'}, // 80 )
{0x08, 0x2A, 0x1C, 0x2A, 0x08, '*'}, // 81 *
{0x08, 0x08, 0x3E, 0x08, 0x08, '+'}, // 82 +
{0x00, 0x58, 0x38, 0x00, 0x00, ','}, // 83 ,
{0x08, 0x08, 0x08, 0x08, 0x08, '-'}, // 84 -
{0x00, 0x30, 0x30, 0x00, 0x00, '.'}, // 85 .
{0x20, 0x10, 0x08, 0x04, 0x02, '/'}, // 86 forward slash
{0x02, 0x04, 0x08, 0x10, 0x20, 0x5c}, // 87 backslash
{0x00, 0x36, 0x36, 0x00, 0x00, ':'}, // 88 :
{0x00, 0x5B, 0x3B, 0x00, 0x00, ';'}, // 89 ;
{0x00, 0x08, 0x14, 0x22, 0x41, '<'}, // 90 <
{0x14, 0x14, 0x14, 0x14, 0x14, '='}, // 91 =
{0x41, 0x22, 0x14, 0x08, 0x00, '>'}, // 92 >
{0x02, 0x01, 0x51, 0x09, 0x06, '?'}, // 93 ?
{0x30, 0x35, 0x48, 0x40, 0x30, 0xBF}, // 94 <20> Inverted question mark
{0x3E, 0x41, 0x5D, 0x55, 0x1E, '@'}, // 95 @
{0x00, 0x00, 0x7F, 0x41, 0x41, '['}, // 96 [
{0x41, 0x41, 0x7F, 0x00, 0x00, ']'}, // 97 ]
{0x04, 0x02, 0x7F, 0x02, 0x04, '-'}, // 98 -
{0x40, 0x40, 0x40, 0x40, 0x40, '_'}, // 99 _
{0x00, 0x07, 0x0B, 0x00, 0x00, '`'}, // 100 `
{0x00, 0x08, 0x36, 0x41, 0x00, '{'}, // 101 {
{0x00, 0x00, 0x77, 0x00, 0x00, '|'}, // 102 |
{0x00, 0x41, 0x36, 0x08, 0x00, '}'}, // 103 }
{0x08, 0x04, 0x08, 0x10, 0x08, '~'}, // 104 ~
// user defined or unusual desired characters
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 105 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 106 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 107 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 108 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 109 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 110 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 111 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 112 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 113 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 114 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 115 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 116 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 117 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 118 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 119 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 120 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 121 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 122 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 123 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 124 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 125 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8}, // 126 filler - FULL
{0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xD8} // 127 FINAL - FULL Latin capital letter O with slash
};
// filler has been added to keep size static in the future, this script may be edited to add custom characters if desired
#endif

View File

@@ -16,7 +16,7 @@
#pragma config IESO = OFF // Internal External Switchover bit (Internal/External Switchover mode is disabled)
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is disabled)
#pragma config LVP = OFF // Low Voltage Programming Enable bit (RB3 pin has digital I/O, HV on MCLR must be used for programming)
#pragma config BOR4V = BOR40V // Brown-out Reset Selection bit (Brown-out Reset set to 4.0V)
#pragma config BOR4V = BOR21V // Brown-out Reset Selection bit (Brown-out Reset set to 4.0V)
#pragma config WRT = OFF // Flash Program Memory Self Write Enable bits (Write protection off)
// Used by the XC8 delay_ms(x) macro
@@ -32,8 +32,38 @@
#define DISABLED 0
#define LED_AMOUNT 4
#define POT_STEP_AMOUNT 10
#define POT_LIMIT 1023
#define DEADZONE 2
#define DEADZONE 15
#define SCK_PIN PORTCbits.RC3
#define SDO_DDIR TRISCbits.TRISC5 // DDIR = Data DIRection
#define SDI_DDIR TRISCbits.TRISC4
#define SCK_DDIR TRISCbits.TRISC3
#define SSPM SSPCONbits.SSPM
char selLoadString[8] = "SEL. 00";
char volLoadString[8] = "VOL. 000";
char volumeBuffer[40];
char selectBuffer[40];
//screen 1, right side
#define RESET_1 PORTCbits.RC2
#define CENABLE_1 PORTCbits.RC4
#define BLANK_1 PORTCbits.RC6
#define RSELECT_1 PORTCbits.RC7
#define RESET_PINNUM 2
#define CENABLE_PINNUM 4
#define BLANK_PINNUM 6
#define RSELECT_PINNUM 7
//screen 2, left side
#define RESET_2 PORTDbits.RD2
#define CENABLE_2 PORTDbits.RD4
#define BLANK_2 PORTDbits.RD6
#define RSELECT_2 PORTDbits.RD7
#endif

View File

@@ -19,7 +19,7 @@ endif
endif
# Environment
MKDIR=gnumkdir -p
MKDIR=mkdir -p
RM=rm -f
MV=mv
CP=cp
@@ -51,17 +51,17 @@ OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE}
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
# Source Files Quoted if spaced
SOURCEFILES_QUOTED_IF_SPACED=src/initialisation.c src/main.c
SOURCEFILES_QUOTED_IF_SPACED=src/initialisation.c src/main.c src/HCMS2913.c
# Object Files Quoted if spaced
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/src/initialisation.p1 ${OBJECTDIR}/src/main.p1
POSSIBLE_DEPFILES=${OBJECTDIR}/src/initialisation.p1.d ${OBJECTDIR}/src/main.p1.d
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/src/initialisation.p1 ${OBJECTDIR}/src/main.p1 ${OBJECTDIR}/src/HCMS2913.p1
POSSIBLE_DEPFILES=${OBJECTDIR}/src/initialisation.p1.d ${OBJECTDIR}/src/main.p1.d ${OBJECTDIR}/src/HCMS2913.p1.d
# Object Files
OBJECTFILES=${OBJECTDIR}/src/initialisation.p1 ${OBJECTDIR}/src/main.p1
OBJECTFILES=${OBJECTDIR}/src/initialisation.p1 ${OBJECTDIR}/src/main.p1 ${OBJECTDIR}/src/HCMS2913.p1
# Source Files
SOURCEFILES=src/initialisation.c src/main.c
SOURCEFILES=src/initialisation.c src/main.c src/HCMS2913.c
@@ -92,7 +92,7 @@ ${OBJECTDIR}/src/initialisation.p1: src/initialisation.c nbproject/Makefile-${C
@${MKDIR} "${OBJECTDIR}/src"
@${RM} ${OBJECTDIR}/src/initialisation.p1.d
@${RM} ${OBJECTDIR}/src/initialisation.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=pickit5 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/initialisation.p1 src/initialisation.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=none -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/initialisation.p1 src/initialisation.c
@-${MV} ${OBJECTDIR}/src/initialisation.d ${OBJECTDIR}/src/initialisation.p1.d
@${FIXDEPS} ${OBJECTDIR}/src/initialisation.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
@@ -100,16 +100,24 @@ ${OBJECTDIR}/src/main.p1: src/main.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}/src"
@${RM} ${OBJECTDIR}/src/main.p1.d
@${RM} ${OBJECTDIR}/src/main.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=pickit5 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/main.p1 src/main.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=none -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/main.p1 src/main.c
@-${MV} ${OBJECTDIR}/src/main.d ${OBJECTDIR}/src/main.p1.d
@${FIXDEPS} ${OBJECTDIR}/src/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/src/HCMS2913.p1: src/HCMS2913.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}/src"
@${RM} ${OBJECTDIR}/src/HCMS2913.p1.d
@${RM} ${OBJECTDIR}/src/HCMS2913.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=none -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/HCMS2913.p1 src/HCMS2913.c
@-${MV} ${OBJECTDIR}/src/HCMS2913.d ${OBJECTDIR}/src/HCMS2913.p1.d
@${FIXDEPS} ${OBJECTDIR}/src/HCMS2913.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
else
${OBJECTDIR}/src/initialisation.p1: src/initialisation.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}/src"
@${RM} ${OBJECTDIR}/src/initialisation.p1.d
@${RM} ${OBJECTDIR}/src/initialisation.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/initialisation.p1 src/initialisation.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/initialisation.p1 src/initialisation.c
@-${MV} ${OBJECTDIR}/src/initialisation.d ${OBJECTDIR}/src/initialisation.p1.d
@${FIXDEPS} ${OBJECTDIR}/src/initialisation.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
@@ -117,10 +125,18 @@ ${OBJECTDIR}/src/main.p1: src/main.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}/src"
@${RM} ${OBJECTDIR}/src/main.p1.d
@${RM} ${OBJECTDIR}/src/main.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/main.p1 src/main.c
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/main.p1 src/main.c
@-${MV} ${OBJECTDIR}/src/main.d ${OBJECTDIR}/src/main.p1.d
@${FIXDEPS} ${OBJECTDIR}/src/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/src/HCMS2913.p1: src/HCMS2913.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}/src"
@${RM} ${OBJECTDIR}/src/HCMS2913.p1.d
@${RM} ${OBJECTDIR}/src/HCMS2913.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o ${OBJECTDIR}/src/HCMS2913.p1 src/HCMS2913.c
@-${MV} ${OBJECTDIR}/src/HCMS2913.d ${OBJECTDIR}/src/HCMS2913.p1.d
@${FIXDEPS} ${OBJECTDIR}/src/HCMS2913.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
endif
# ------------------------------------------------------------------------------------
@@ -140,13 +156,15 @@ endif
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
${DISTDIR}/picamp.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk ../picamp-rotary.X/dist/default/debug/picamp-rotary.X.a ../picamp-potentiometer.X/dist/default/debug/picamp-potentiometer.X.a
@${MKDIR} ${DISTDIR}
${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/picamp.X.${IMAGE_TYPE}.map -D__DEBUG=1 -mdebugger=pickit5 -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -mrom=default,-1f00-1ffe -mram=default,-0-0,-70-70,-80-80,-f0-f0,-100-100,-170-170,-180-180,-1e5-1f0 $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/picamp.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} ..\picamp-rotary.X\dist\default\debug\picamp-rotary.X.a ..\picamp-potentiometer.X\dist\default\debug\picamp-potentiometer.X.a
${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/picamp.X.${IMAGE_TYPE}.map -D__DEBUG=1 -mdebugger=none -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -mrom=default,-1f00-1ffe -mram=default,-0-0,-70-70,-80-80,-f0-f0,-100-100,-170-170,-180-180,-1e5-1f0 $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/picamp.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} ../picamp-rotary.X/dist/default/debug/picamp-rotary.X.a ../picamp-potentiometer.X/dist/default/debug/picamp-potentiometer.X.a
@${RM} ${DISTDIR}/picamp.X.${IMAGE_TYPE}.hex
else
${DISTDIR}/picamp.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk ../picamp-rotary.X/dist/default/production/picamp-rotary.X.a ../picamp-potentiometer.X/dist/default/production/picamp-potentiometer.X.a
@${MKDIR} ${DISTDIR}
${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/picamp.X.${IMAGE_TYPE}.map -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/picamp.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} ..\picamp-rotary.X\dist\default\production\picamp-rotary.X.a ..\picamp-potentiometer.X\dist\default\production\picamp-potentiometer.X.a
${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/picamp.X.${IMAGE_TYPE}.map -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mno-default-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/picamp.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} ../picamp-rotary.X/dist/default/production/picamp-rotary.X.a ../picamp-potentiometer.X/dist/default/production/picamp-potentiometer.X.a
endif

View File

@@ -1,13 +1,13 @@
#
#Wed Mar 06 12:04:57 CET 2024
default.languagetoolchain.version=2.45
default.Pack.dfplocation=C\:\\Program Files\\Microchip\\MPLABX\\v6.15\\packs\\Microchip\\PIC16Fxxx_DFP\\1.4.149
default.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=723771b957e0f1e0ec1761a42d8bb5e8
#Wed Mar 06 16:07:14 CET 2024
default.languagetoolchain.version=2.46
default.Pack.dfplocation=
conf.ids=default
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc8\\v2.45\\bin
host.id=2cdp-lqgb-i2
configurations-xml=c900431f81c44a9b6a444850fdc0f22a
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=e62346c0c0ecee2637e613b49cb7b7fa
default.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=486b02ed36e5bdffb1f797e38fa058e5
proj.dir=C\:\\Users\\wesse\\Downloads\\PICAMP-bbcdff189bdb53bccc968032c5cc010f25c24f1c\\picamp.X
host.platform=windows
default.languagetoolchain.dir=/home/burhan/.local/share/microchip/xc8/v2.46/bin
host.id=1odb-89vf-4o
configurations-xml=135dbe756f138e4ec6c0a089be24747b
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
default.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
proj.dir=/home/burhan/Desktop/PICAMP-main/picamp.X
default.com-microchip-mplab-mdbcore-pk4hybrid-Pk4HybridTooImpl.md5=916239579355067caf3c3a7796c790dc
host.platform=linux

View File

@@ -14,24 +14,22 @@
# You can invoke make with the values of the macros:
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/
PATH_TO_IDE_BIN=/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
PATH:=C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
PATH:=/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.15\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/"
MP_JAVA_PATH="/home/burhan/.local/share/microchip/mplabx/v6.20/sys/java/zulu8.64.0.19-ca-fx-jre8.0.345-linux_x64/bin/"
OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_CC="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
# MP_CPPC is not defined
# MP_BC is not defined
MP_AS="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_LD="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-cc.exe"
MP_AR="C:\Program Files\Microchip\xc8\v2.45\bin\xc8-ar.exe"
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.15/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_AS="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
MP_LD="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-cc"
MP_AR="/home/burhan/.local/share/microchip/xc8/v2.46/bin/xc8-ar"
DEP_GEN=${MP_JAVA_PATH}java -jar "/home/burhan/.local/share/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
# MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined
MP_AS_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_LD_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
MP_AR_DIR="C:\Program Files\Microchip\xc8\v2.45\bin"
DFP_DIR=C:/Program Files/Microchip/MPLABX/v6.15/packs/Microchip/PIC16Fxxx_DFP/1.4.149
MP_AS_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
MP_LD_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"
MP_AR_DIR="/home/burhan/.local/share/microchip/xc8/v2.46/bin"

View File

@@ -9,8 +9,15 @@
<itemPath>include/initialisation.h</itemPath>
<itemPath>include/rotary_encoder.h</itemPath>
<itemPath>include/potentiometer.h</itemPath>
<itemPath>include/HCMS2913.h</itemPath>
<itemPath>include/ascii.h</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="true">
<itemPath>Makefile</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
projectFiles="true">
@@ -21,13 +28,9 @@
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>src/initialisation.c</itemPath>
<itemPath>src/main.c</itemPath>
<itemPath>src/HCMS2913.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false">
<itemPath>Makefile</itemPath>
</logicalFolder>
</logicalFolder>
<sourceRootList>
<Elem>.</Elem>
@@ -40,10 +43,10 @@
<targetDevice>PIC16F887</targetDevice>
<targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard>
<platformTool>PK5Tool</platformTool>
<platformTool>pk4hybrid</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.45</languageToolchainVersion>
<platform>3</platform>
<languageToolchainVersion>2.46</languageToolchainVersion>
<platform>2</platform>
</toolsSet>
<packs>
<pack name="PIC16Fxxx_DFP" vendor="Microchip" version="1.4.149"/>

View File

@@ -0,0 +1,3 @@
#
#Wed Mar 06 16:15:12 CET 2024
PICkit\ 4/CHECK_4_HIGH_VOLTAGE_VPP=true

View File

@@ -4,8 +4,8 @@
<defaultConf>0</defaultConf>
<confs>
<conf name="default" type="2">
<platformToolSN>:=MPLABComm-USB-Microchip:=&lt;vid>04D8:=&lt;pid>9036:=&lt;rev>0100:=&lt;man>Microchip Technology Incorporated:=&lt;prod>MPLAB PICkit 5:=&lt;sn>020026702RYN005435:=&lt;drv>x:=&lt;xpt>b:=end</platformToolSN>
<languageToolchainDir>C:\Program Files\Microchip\xc8\v2.45\bin</languageToolchainDir>
<platformToolSN>:=MPLABComm-USB-Microchip:=&lt;vid>04D8:=&lt;pid>9012:=&lt;rev>0100:=&lt;man>Microchip Technology Incorporated:=&lt;prod>MPLAB PICkit 4:=&lt;sn>BUR212676149:=&lt;drv>x:=&lt;xpt>b:=end</platformToolSN>
<languageToolchainDir>/home/burhan/.local/share/microchip/xc8/v2.46/bin</languageToolchainDir>
<mdbdebugger version="1">
<placeholder1>place holder 1</placeholder1>
<placeholder2>place holder 2</placeholder2>

View File

@@ -3,7 +3,7 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/wesse/Downloads/PICAMP-bbcdff189bdb53bccc968032c5cc010f25c24f1c/picamp.X/include/rotary_encoder.h</file>
<file>file:/home/burhan/Desktop/PICAMP-main/picamp.X/src/main.c</file>
</group>
</open-files>
</project-private>

152
picamp.X/src/HCMS2913.c Normal file
View File

@@ -0,0 +1,152 @@
#include "../include/HCMS2913.h"
#include "../include/ascii.h"
#include "../include/config.h"
void HCMS_spi_init(sspmode mst_slv_oscdiv, rxsmpmoment sdi_rx_smp, clkpol clock_pol, txclkedge sdo_tx_edge) {
//Todo Burhan: remove this dirty fix
TRISC = 0;
TRISD = 0;
PORTC = 0;
PORTD = 0;
// 1. Set `SSPM' datafield (SPI master / slave mode and prescaler
// selection)
SSPM = mst_slv_oscdiv;
// 2. Set SDO_DDIR for SDO to behave as an output
SDO_DDIR = 0;
SDI_DDIR = 0;
// 3. If a slave mode was selected:
// 3a. The SMP bit MUST remain clear (see datasheet)
// 3b. Set SCK_DDIR for SCK to behave like an input
// 3c. The data line `idle state' (CKP bit) must match the
// master's clock idle state. To achieve this, set the
// CKP bit to whatever value can be read on the SCK_PIN.
// 3d. Set up the recieve interrupt (PIE1.SSPIE). Don't
// forget PEIE and GIE (interrupt masking hierarchy).
if (mst_slv_oscdiv > 3) {
SMP = 0;
SCK_DDIR = 1;
CKP = SCK_PIN;
}// 4. Else (if a master mode was selected):
// 4a. The SMP bit needs to be set according to argument
// `sdi_rx_smp'
// 4b. Set SCK_DDIR for SCK to behave like an output
// 4c. The data line `idle state' (CKP bit) needs to be set
// according to argument `clock_pol'
else {
SMP = sdi_rx_smp;
SCK_DDIR = 0;
CKP = clock_pol;
}
//SSPIE = 1;
// 5. Set the CKE bit according to the `sdo_tx_edge' and `clock_pol'
// parameters (i.e. if `sdo_tx_edge' and `clock_pol' select
// mode 0 (CKE 1, CKP 0), then the CKE bit must be set, etc. -
// (handle all SPI modes ... !)
CKE = sdo_tx_edge;
if (clock_pol == 1 || SCK_PIN == 1) {
CKE ^= 1;
}
// 6. Enable the SPI module (by setting SSPEN bit).
SSPEN = 1;
}
void delayNanoSeconds(unsigned long nanoSeconds);
#define BUFFER SSPBUF
void spi_transmit(char c) {
// FILL. THAT. BUFFER.
BUFFER = c;
}
void setpin(volatile unsigned char *port, unsigned char pin, int value) {
if (value == 0)
*port &= ~(1 << pin);
else
*port |= 1 << pin;
}
void HCMS_init(volatile unsigned char *port, uint8_t _RESET, uint8_t _CENABLE, uint8_t _RSELECT) {
setpin(port, _RESET, 0);
delayNanoSeconds(200);
setpin(port, _RESET, 1);
setpin(port, _RSELECT, 0);
setpin(port, _CENABLE, 0);
for (int i = 0; i < 40; i++) {
spi_transmit(0b00000000);
delayNanoSeconds(200);
}
setpin(port, _CENABLE, 1);
setpin(port, _RSELECT, 1);
setpin(port, _CENABLE, 0);
spi_transmit(0b01111111);
delayNanoSeconds(200);
setpin(port, _CENABLE, 1);
setpin(port, _CENABLE, 0);
spi_transmit(0b10000000);
delayNanoSeconds(200);
setpin(port, _CENABLE, 1);
setpin(port, _CENABLE, 0);
spi_transmit(0b01111111);
delayNanoSeconds(200);
setpin(port, _CENABLE, 1);
setpin(port, _CENABLE, 0);
spi_transmit(0b10000000);
delayNanoSeconds(200);
setpin(port, _CENABLE, 1);
setpin(port, _RSELECT, 0);
}
void load_buffer(int character, int position, char *bufferSelected) {
for (int i = 0; i < 5; i++) {
bufferSelected[position * 5 + i] = ascii[character][i];
}
}
int TableLookup(char lookup) {
for (int i = 0; i < 128; ++i) {
if (ascii[i][5] == lookup) {
return i;
}
}
return 127; // Character not found in the ASCII table
}
void HCMS_load_word(const char *_string, char *bufferSelected, volatile unsigned char *port, uint8_t _CENABLE) {
short length = 0;
setpin(port, _CENABLE, 0);
while (_string[length] != '\0' && length < 8) {
load_buffer(TableLookup(_string[length]), length, bufferSelected);
length++;
}
while (length < 8) {
load_buffer(TableLookup(' '), length, bufferSelected);
length++;
}
for (int i = 0; i < 40; i++) {
spi_transmit(bufferSelected[i]);
}
delayNanoSeconds(200);
setpin(port, _CENABLE, 1);
}
void delayNanoSeconds(unsigned long nanoSeconds) {
const unsigned long cyclesPerNanoSecond = 10;
unsigned long cyclesToDelay = nanoSeconds * cyclesPerNanoSecond;
TMR1 = 0;
while (cyclesToDelay > 0) {
cyclesToDelay--;
}
}

View File

@@ -6,6 +6,7 @@
#include "../include/initialisation.h"
#include "../include/rotary_encoder.h"
#include "../include/potentiometer.h"
#include "../include/HCMS2913.h"
// Rotary encoder position
char count = 0;
@@ -15,67 +16,86 @@ void pic_init(void);
void pic_loop(void);
void main(void) {
// Do all initialisation here
pic_init();
// Start indefinite program loop
pic_loop();
// Do all initialisation here
pic_init();
// Start indefinite program loop
pic_loop();
}
void pic_loop(void) {
// todo(burhan): WRITE_TO_LED(VOL: (read_pot() * 100) / 1023);
// todo: Remove code for LED showing after screen usage;
// Initialize potentiometer step array
int stepArray[LED_AMOUNT] = {0};
populate_step_array(stepArray, LED_AMOUNT, POT_LIMIT);
int stepArray[LED_AMOUNT] = {0};
populate_step_array(stepArray, LED_AMOUNT, POT_LIMIT);
short calcVolume;
while (1) {
if (count == 0) {
// Parse result from potentiometer
int result = read_pot();
while (1) {
HCMS_load_word(selLoadString, selectBuffer, &PORTD, CENABLE_PINNUM);
HCMS_load_word(volLoadString, volumeBuffer, &PORTC, CENABLE_PINNUM);
// if (count == 0) {
// Parse result from potentiometer
int result = read_pot();
// Loop through all `stepArray`, check if the output of the potmeter
// (on `ADRES`) falls inbetween the steps - `DEADZONE`, if so execute
// An OR/AND bitshift operation in order to turn on the corresponding
// LED on `PORTA`.
for (int i = 0; i < LED_AMOUNT; i++) {
if (result > (stepArray[i] - DEADZONE)) {
PORTA = (unsigned char)(PORTA & ~(1 << i));
} else if (result <= (stepArray[i] - DEADZONE)) {
PORTA = (unsigned char)(PORTA | (1 << i));
// Loop through all `stepArray`, check if the output of the potmeter
// (on `ADRES`) falls inbetween the steps - `DEADZONE`, if so execute
// An OR/AND bitshift operation in order to turn on the corresponding
// LED on `PORTA`.
// for (int i = 0; i < LED_AMOUNT; i++) {
// if (result > (stepArray[i] - DEADZONE)) {
// PORTA = (unsigned char) (PORTA & ~(1 << i));
// } else if (result <= (stepArray[i] - DEADZONE)) {
// PORTA = (unsigned char) (PORTA | (1 << i));
// }
// }
// }
calcVolume = result / POT_STEP_AMOUNT;
if (calcVolume > 100) {
calcVolume = 100;
}
}
if (calcVolume < 0) {
calcVolume = 0;
}
selLoadString[6] = '0' + count / 10;
selLoadString[7] = '0' + (count % 10);
volLoadString[5] = '0' + (char) (calcVolume / 100);
volLoadString[6] = '0' + (char) (calcVolume / 10 > 9 ? 0 : calcVolume / 10);
volLoadString[7] = '0' + (char) (calcVolume % 10);
}
}
}
void pic_init(void) {
OscillatorConfig osc_config = { INTERNAL_CLK, KHZ500, INTERNAL_FOSC };
init_osc(osc_config);
OscillatorConfig osc_config = {INTERNAL_CLK, MHZ008, INTERNAL_FOSC};
init_osc(osc_config);
PinConfig pin_config[] = { { &TRISA, &PORTA, &ANSEL, OUTPUT, DIGITAL } };
init_gpio(pin_config, 1);
PinConfig pin_config[] = {
{ &TRISA, &PORTA, &ANSEL, OUTPUT, DIGITAL}
};
init_gpio(pin_config, 1);
// Moved to rotary_encoder.c
// InterruptConfig int_config = { GIE_ENABLED, EINT_ENABLED, PEIE_ENABLED,
// T0INT_ENABLED, RBINT_ENABLED, FALLING_EDGE };
// init_int(int_config);
// Moved to rotary_encoder.c
// InterruptConfig int_config = { GIE_ENABLED, EINT_ENABLED, PEIE_ENABLED,
// T0INT_ENABLED, RBINT_ENABLED, FALLING_EDGE };
// init_int(int_config);
init_rotary(IOCRB4, IOCRB5, TRISBbits.TRISB4, TRISBbits.TRISB5);
init_pot(ADC_AN07, TRISEbits.TRISE2);
init_rotary(IOCRB4, IOCRB5, TRISBbits.TRISB4, TRISBbits.TRISB5);
init_pot(ADC_AN07, TRISEbits.TRISE2);
HCMS_spi_init(MST_OSC_DIV_04, SMP1_SDI_END, CKP0_CPOL0_IDLE_LOW, CKE1_CPHA0_TRSMIT_ACT2IDL);
HCMS_init(&PORTC, RESET_PINNUM, CENABLE_PINNUM, RSELECT_PINNUM);
HCMS_init(&PORTD, RESET_PINNUM, CENABLE_PINNUM, RSELECT_PINNUM);
}
// #[routine:interrupt_service]
void __interrupt() isr(void) {
if (INTCONbits.RBIF == INT_OCCURED) {
// Parse rotary changes into `count`, shift it into `PORTA`
parse_rotary(REA, REB, &count, LED_AMOUNT, 0);
if (INTCONbits.RBIF == INT_OCCURED) {
// Parse rotary changes into `count`, shift it into `PORTA`
parse_rotary(REA, REB, &count, LED_AMOUNT, 0);
// todo(burhan): WRITE_TO_LED(IN: count);
// todo: Remove code for LED showing after screen usage;
PORTA = (unsigned char) (~(1 << count));
//PORTA = (unsigned char) (~(1 << count));
// Clear the Port B change interrupt flag
INTCONbits.RBIF = INT_AWAITING;
INTCONbits.INTF = INT_AWAITING;
}
// Clear the Port B change interrupt flag
INTCONbits.RBIF = INT_AWAITING;
INTCONbits.INTF = INT_AWAITING;
}
}