Skip to content

Commit

Permalink
MPAE-15586: Modified example
Browse files Browse the repository at this point in the history
  • Loading branch information
robertperkel committed Feb 28, 2023
1 parent 17c0d5e commit 46ec32c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ All signals (excl. analog input) are connected on the Curosity Nano without modi
| Pin | Function
| --- | ---------
| RA0 | Pushbutton (SW0)
| RA1 | OPAMP Output (reserved)
| RB1 | Analog Input (non-demo mode)
| RB4 | UART TX
| RB5 | UART RX (unused, reserved)
Expand Down
5 changes: 1 addition & 4 deletions pic18f56q71-simple-oscilloscope-mplab-mcc.X/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ void LED_updateState(void)
//If defined, the system is in demo mode
#define OSCILLOSCOPE_DEMO_MODE

//ADC input channel to sample RB1 (OPA1IN3+)
#define OPAMP_INPUT_SAMPLE 0b10001001

//Threshold for clipping warning
#define ADC_THRESHOLD_LEVEL 0xE66

Expand Down Expand Up @@ -90,7 +87,7 @@ int main(void)
ADC_SetUpperThreshold(ADC_THRESHOLD_LEVEL);

//Start ADC Conversion on the output of OPAMP when sampling OPA1IN3+
ADC_StartConversionOnChannel(OPAMP_INPUT_SAMPLE);
ADC_StartConversionOnChannel(channel_ANA1);

//Assign UART TX Priority
DMA1_SetDMAPriority(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ typedef enum
channel_OPA2IN1_pos = 0x41,
channel_OPA2IN2_pos = 0x4b,
channel_OPA2IN3_pos = 0x4a,
channel_ANA1 = 0x1
channel_ANA1 = 0x1,
RB1_IN3 = 0x9
} adc_channel_t;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ void ADC_Initialize(void)
//CGA0 disabled; CGA1 enabled; CGA2 disabled; CGA3 disabled; CGA4 disabled; CGA5 disabled; CGA6 disabled; CGA7 disabled;
ADCGA = 0x2;

//CGB0 disabled; CGB1 disabled; CGB2 disabled; CGB3 disabled; CGB4 disabled; CGB5 disabled; CGB6 disabled; CGB7 disabled;
ADCGB = 0x0;
//CGB0 disabled; CGB1 enabled; CGB2 disabled; CGB3 disabled; CGB4 disabled; CGB5 disabled; CGB6 disabled; CGB7 disabled;
ADCGB = 0x2;

//CGC0 disabled; CGC1 disabled; CGC2 disabled; CGC3 disabled; CGC4 disabled; CGC5 disabled; CGC6 disabled; CGC7 disabled;
ADCGC = 0x0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ void OPA1_Initialize(void)
//NCH No Connection; PCH OPA1IN+;
OPA1CON2 = 0x2;

//FMS No Connection; INTOE Enabled; PSS OPA1IN3+;
OPA1CON3 = 0x23;
//FMS No Connection; INTOE Disabled; PSS OPA1IN3+;
OPA1CON3 = 0x3;

//PTRES No reset; OFCST Calibration complete; OFCSEL Factory calibrated value in OPAxOFFSET;
OPA1CON4 = 0x0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ void Timer2_Initialize(void){
T2HLT = 0x11;
// TRSEL TMR4_postscaled;
T2RST = 0x2;
// PR 24;
T2PR = 0x18;
// PR 9;
T2PR = 0x9;
// TMR 0x0;
T2TMR = 0x0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<targetPluginBoard></targetPluginBoard>
<platformTool>nEdbgTool</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.40</languageToolchainVersion>
<languageToolchainVersion>2.41</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
Expand Down Expand Up @@ -355,6 +355,8 @@
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-ffff"/>
<property key="poweroptions.powerenable" value="false"/>
<property key="programmerToGoFilePath"
value="C:/Users/C62081/Documents/GIT Repos/pic18f56q71-simple-oscilloscope-mplab-mcc/pic18f56q71-simple-oscilloscope-mplab-mcc.X/debug/free/pic18f56q71-simple-oscilloscope-mplab-mcc_ptg"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
Expand All @@ -380,7 +382,7 @@
<targetPluginBoard></targetPluginBoard>
<platformTool>nEdbgTool</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.40</languageToolchainVersion>
<languageToolchainVersion>2.41</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
Expand Down Expand Up @@ -593,6 +595,8 @@
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-ffff"/>
<property key="poweroptions.powerenable" value="false"/>
<property key="programmerToGoFilePath"
value="C:/Users/C62081/Documents/GIT Repos/pic18f56q71-simple-oscilloscope-mplab-mcc/pic18f56q71-simple-oscilloscope-mplab-mcc.X/debug/pro/pic18f56q71-simple-oscilloscope-mplab-mcc_ptg"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
Expand Down

Large diffs are not rendered by default.

0 comments on commit 46ec32c

Please sign in to comment.