Skip to content

Commit ca0f7bd

Browse files
committed
USB mode working.
1 parent 6f519af commit ca0f7bd

File tree

7 files changed

+425
-442
lines changed

7 files changed

+425
-442
lines changed

pic24f-lcd-usb-curiosity-lcd-power.X/MyConfig.mc3

Lines changed: 406 additions & 397 deletions
Large diffs are not rendered by default.

pic24f-lcd-usb-curiosity-lcd-power.X/application/usb_operational_mode.c

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ enum DISPLAY_MODE
4444
//------------------------------------------------------------------------------
4545
//Private prototypes
4646
//------------------------------------------------------------------------------
47-
static void UpdateSegmentedLCD(void);
48-
static void UpdatePrintout(void);
49-
5047
static void USBPowerModeTask_Initialize(void);
5148
static void USBPowerModeTask_Deinitialization(void);
5249
static void USBPowerModeTasks(void);
@@ -69,42 +66,19 @@ const struct OPERATIONAL_MODE usb_operational_mode = {
6966
static void USBPowerModeTask_Initialize(void)
7067
{
7168
SYSTEM_Initialize();
72-
//Turn on a timer, so to generate periodic interrupts.
73-
TIMER_SetConfiguration(TIMER_CONFIGURATION_1MS);
74-
75-
//Register the ButtonDebounce() callback function, so it gets called periodically
76-
//when the timer interrupts occur (in this case at 1:1 rate, so ButtonDebounce()
77-
//executes once per 1ms).
78-
TIMER_RequestTick(&UpdatePrintout, 10);
7969

8070
LCD_Initialize();
8171
LCD_SetPowerMode(LCD_POWER_MODE_HIGH);
8272
LCD_DEMO_SetBatteryStatus(BATTERY_STATUS_UNKNOWN);
73+
LCD_DEMO_PrintPIC24();
8374
}
8475

8576
void USBPowerModeTasks(void)
8677
{
87-
if(update_printout == true)
88-
{
89-
update_printout = false;
90-
91-
RTCC_TimeGet(&date_time);
92-
93-
UpdateSegmentedLCD();
94-
}
78+
9579
}
9680

9781
static void USBPowerModeTask_Deinitialization(void)
9882
{
9983
TIMER_SetConfiguration(TIMER_CONFIGURATION_OFF);
10084
}
101-
102-
static void UpdateSegmentedLCD(void)
103-
{
104-
LCD_DEMO_PrintPIC24();
105-
}
106-
107-
static void UpdatePrintout(void)
108-
{
109-
update_printout = true;
110-
}

pic24f-lcd-usb-curiosity-lcd-power.X/mcc_generated_files/lcd.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ void LCD_Initialize()
5858
// Disable LCD module before configuring
5959
LCDCONbits.LCDEN = 0;
6060

61-
//BIASMD 1/3 Bias mode; LP 1:11; WFT Type-A waveform;
62-
LCDPS = 0x0A;
61+
//BIASMD 1/3 Bias mode; LP 1:1; WFT Type-A waveform;
62+
LCDPS = 0x00;
6363
//LRLAP High-Power mode; LRLBP High-Power mode; VLCD1PE Bias 1 level is internal; LCDCST Max contrast (Min Resistance); VLCD2PE Bias 2 level is internal; VLCD3PE Bias 3 level is internal; LRLAT Internal LCD reference ladder is always in B Power mode; LCDIRE enabled;
6464
LCDREF = 0x80F0;
6565
//CPEN disabled; CLKSEL disabled;
@@ -72,8 +72,8 @@ void LCD_Initialize()
7272
LCDSE2 = 0x4000;
7373
//SE51 disabled; SE62 enabled; SE52 disabled; SE63 disabled; SE60 disabled; SE50 enabled; SE61 enabled; SE48 disabled; SE59 enabled; SE49 disabled; SE57 disabled; SE58 enabled; SE55 disabled; SE56 disabled; SE53 disabled; SE54 disabled;
7474
LCDSE3 = 0x6C04;
75-
//CS FRC; SLPEN enabled; WERR disabled; LMUX 1/8 COM[7:0]; LCDSIDL continues to operate in CPU Idle mode; LCDEN disabled;
76-
LCDCON = 0x07;
75+
//CS LPRC; SLPEN enabled; WERR disabled; LMUX 1/8 COM[7:0]; LCDSIDL continues to operate in CPU Idle mode; LCDEN disabled;
76+
LCDCON = 0x0F;
7777

7878
//Enable memory clear
7979
LCDASTATbits.PMCLEAR = 1;
@@ -108,7 +108,7 @@ void LCD_ModeSet(enum LCD_MODE mode)
108108
LCDACTRLbits.BLINKMODE = 0x0002;//Enable Blink Mode with all pixels
109109
LCDASTATbits.DMSEL = 0x0000;//Primary memory as Display Memory
110110
LCDACTRLbits.BLINKFCS= 0x0001;
111-
LCDFC1 = 0x0002;
111+
LCDFC1 = 0x0975;
112112
LCDACTRLbits.ELCDEN = 1;//Enable LCD enhanced Mode
113113
break;
114114

@@ -117,7 +117,7 @@ void LCD_ModeSet(enum LCD_MODE mode)
117117
LCDACTRLbits.BLINKMODE = 0x0002;//Enable Blink Mode with all pixels
118118
LCDASTATbits.DMSEL = 0x0001;//Secondary memory as Display Memory
119119
LCDACTRLbits.BLINKFCS= 0x0001;
120-
LCDFC1 = 0x0002;
120+
LCDFC1 = 0x0975;
121121
LCDACTRLbits.ELCDEN = 1;//Enable LCD enhanced Mode
122122
break;
123123

@@ -126,7 +126,7 @@ void LCD_ModeSet(enum LCD_MODE mode)
126126
LCDACTRLbits.BLINKMODE = 0x0000;//Disable Blink Mode
127127
LCDASTATbits.DMSEL = 0x0003;//Continuous switch over between primary and secondary memory
128128
LCDACTRLbits.SMFCS = 0x0001;
129-
LCDFC0 = 0x0002;
129+
LCDFC0 = 0x0975;
130130
LCDACTRLbits.ELCDEN = 1;//Enable LCD enhanced Mode
131131
break;
132132

@@ -135,7 +135,7 @@ void LCD_ModeSet(enum LCD_MODE mode)
135135
LCDACTRLbits.BLINKMODE = 0x0001;//Enable Blink Mode with selected pixels
136136
LCDASTATbits.DMSEL = 0x0000;//Primary memory as Display Memory
137137
LCDACTRLbits.BLINKFCS= 0x0001;
138-
LCDFC1 = 0x0002;
138+
LCDFC1 = 0x0975;
139139
LCDACTRLbits.ELCDEN = 1;//Enable LCD enhanced Mode
140140
break;
141141

pic24f-lcd-usb-curiosity-lcd-power.X/mcc_generated_files/mcc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
#include <stdint.h>
5252
#include <stdbool.h>
5353

54-
#include "lcd.h"
54+
#include "adc1.h"
5555
#include "interrupt_manager.h"
5656
#include "traps.h"
57-
#include "adc1.h"
58-
#include "tmr3.h"
5957
#include "rtcc.h"
6058
#include "spi1.h"
59+
#include "tmr3.h"
60+
#include "lcd.h"
6161

6262
#warning "This file will be removed in future MCC releases. Use system.h instead."
6363

pic24f-lcd-usb-curiosity-lcd-power.X/mcc_generated_files/pin_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ void PIN_MANAGER_Initialize (void)
150150
***************************************************************************/
151151
__builtin_write_OSCCONL(OSCCON & 0xbf); // unlock PPS
152152

153-
RPINR20bits.SDI1R = 0x0018; //RD1->SPI1:SDI1
154153
RPOR11bits.RP23R = 0x0007; //RD2->SPI1:SDO1
154+
RPINR20bits.SDI1R = 0x0018; //RD1->SPI1:SDI1
155155
RPOR10bits.RP21R = 0x0008; //RG6->SPI1:SCK1
156156
RPINR20bits.SCK1R = 0x0015; //RG6->SPI1:SCK1
157157

pic24f-lcd-usb-curiosity-lcd-power.X/mcc_generated_files/system.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,19 @@
117117
#include "pin_manager.h"
118118
#include "clock.h"
119119
#include "system.h"
120-
#include "lcd.h"
120+
#include "adc1.h"
121121
#include "interrupt_manager.h"
122122
#include "traps.h"
123-
#include "adc1.h"
124-
#include "tmr3.h"
125123
#include "rtcc.h"
126124
#include "spi1.h"
125+
#include "tmr3.h"
126+
#include "lcd.h"
127127

128128
void SYSTEM_Initialize(void)
129129
{
130130
PIN_MANAGER_Initialize();
131-
INTERRUPT_Initialize();
132131
CLOCK_Initialize();
132+
INTERRUPT_Initialize();
133133
LCD_Initialize();
134134
SPI1_Initialize();
135135
ADC1_Initialize();

pic24f-lcd-usb-curiosity-lcd-power.X/nbproject/configurations.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<targetDevice>PIC24FJ512GU410</targetDevice>
9292
<targetHeader></targetHeader>
9393
<targetPluginBoard></targetPluginBoard>
94-
<platformTool>noID</platformTool>
94+
<platformTool>ICD4Tool</platformTool>
9595
<languageToolchain>XC16</languageToolchain>
9696
<languageToolchainVersion>1.50</languageToolchainVersion>
9797
<platform>3</platform>

0 commit comments

Comments
 (0)