Professional Documents
Culture Documents
(Chapter7)
andtheBasicTimer
BasicTimer
DrivenbyACLK.
BTCNT2can
BTCNT2
generateinterrupts
(asslowas1Hz:
32768/256/128)
BTCNT1isusedto
generate a clock for
generateaclockfor
LCDcontroller
HowLCDworks
Toaligncrystal,voltagemustbepureAC(average=0) typically50150Hz.
ReflectiveLCD
OneCommon(Backplane)Electrode
8Segment(SEG0SEG7)
electrodesarerequired(7
fornumeral,onefor
d i l i t)
decimalpoint).
SEG0andSEG1areoutof
phase (SEG27
phase(SEG2
7notshown).
not shown)
(SEG0alsoinphasewithSEG2,3,5
and7)
COM0SEG0islargeAC
COM0
SEG0 i l
AC
signal,sosegmentis
displayed.
COM0SEG1issmall(zero)
ACsignal,sosegmentis
*not*displayed.
8Segment+1COMis9
totalelectrodes.
TwoCommon(Backplane)Electrode
Multiplexingreducestotalnumberofelectrodes(4Seg +2COM=6electrodes)
COM0andCOM1aremorecomplex
SEG0andSEG1aremorecomplex
COM0SEG0islargeACsignal,so
COM0
SEG0 is large AC signal so
segmentisdisplayed.
COM0SEG1issmall(butnonzero)
COM0
SEG1 i
ll (b t
)
ACsignal(belowsomethreshold
value),sosegmentis*not*displayed.
OffsegmentshavesmallACvoltages,
Onsegmentshavelargevoltages
Totalnumberofsegmentsis:
(#SEG)* (#COM)
ThreeCommon(Backplane)Electrode
Andsoon
butalwaysthetotalnumberof
segmentsis:(#SEG)* (#COM)
LCD_AModule
DirectlydrivesLCDdisplaysby
creatingtheacsegmentand
commonvoltagesignals
automatically.
automatically
Featuresinclude:
Displaymemory
Automaticsignalgeneration
Configurableframefrequency
Blinkingcapability
Regulatedchargepump
Contrast control by software
Contrastcontrolbysoftware
Supportfor4typesofLCDs:
Static
2mux,1/2biasor1/3bias
3 mux 1/2 bias or 1/3 bias
3mux,1/2biasor1/3bias
4mux,1/2biasor1/3bias
Outputs
40SEG(SelectedasLCDpinsingroups)
(COM1 2 3 multiplexed with P5)
4 COM (COM1,2,3
Up to 160 segments
Voltagegeneration
(
(SeeUsersManualfordetails)
lf d
l)
Display Controller
DisplayController
Displaymemoryhas20
p y
y
bytes=160bits.
Onebitforeachdisplayable
segmentt
Thekeytousingitis
understandingthemapping
g
pp g
betweenbitsandsegments
Controllertakescareofall
voltagegeneration
l
i
ExperimentersboardLCD
22SEG*4COM=88
segments
EachSEGlinegoesto4
segments
Oneofthefourischosen
(serially)bytheCOMlines
More
Detail
S0
S1
S7
Fromasoftwareperspective,wedontcareabout
SEGsandCOMs,justthebitsintheLCDmemory.
The LCD controller takes care of details
TheLCDcontrollertakescareofdetails.
S7
S1
S0
Youdthinkthemappingsareasshown
butyoudbewrong!
Offfsetaddreessby2byttes
Correct
Mapping
pp g
S0
S1
S0SBLCDA4=S4MSP430=mem 0x93,LSBs
S7
S7SBLCDA4=S11MSP430=mem 0x96,MSBs
S1SBLCDA4=S5MSP430=mem 0x93,MSBs
S0
S1
S7
S7
S1
S0
Digit4
g
// LCD Segments
#define LCD_A
#define LCD_B
#define LCD_C
#define LCD_D
#define LCD_E
#define LCD_F
#define LCD_G
0x01
0x02
0x04
0x08
0x40
0x10
0x20
Memory
Bit7
Bit0
096h
DP4
//
//
//
//
//
//
//
//
//
//
'0'
'1'
'2'
'3'
'4'
'5'
'6'
'7'
'8'
'9'
// LCD Constants
#define LCD_MEM_OFFSET
Alldigits
2
Maincodesetup
void main(void) {
//*******Code not shown************//
// Set ticker to 32768/(256*128) = 1 Hz, Enable BT interrupt
BTCTL = BT_fCLK2_DIV128 | BT_fCLK2_ACLK_DIV256;
IE2 |=
| BTIE;
P2DIR |= BIT2;// Bit for LED
initLCD_A();// Initialize LCD
while(1) {
//*******Code not shown************//
}
}
// Basic Timer Interrupt Service Routine
#pragma vector=BASICTIMER_VECTOR
__interrupt void basic_timer_ISR(void) {
_bic_SR_register_on_exit(LPM3_bits);
}
Maincodewhile(1)
while
hil (1) {
liveTime = BTCNT2;
_BIS_SR(LPM3_bits + GIE);
P2OUT = BIT2;
if (++sec1>9) {
sec1=0;
if (++sec10>5) {
sec10=0;
if (++min>10) min=0;
}
}
dispChar (1,sec1);
dispChar (2,sec10);
dispChar (3,min);
// Display seconds
// Display 10's of seconds
// Display minutes
// Toggle colon.
LCDRegisters
EnablingSegments
Segmentsareenabled4
at a time
atatime
References
Verycompleteexamplecodeat:http://focus.ti.com/docs/toolsw/folders/print/mspexp430fg4618.html
link labeled: MSP430FG4618/F2013
linklabeled:
MSP430FG4618/F2013Experimenter
ExperimenterssBoardSoftware(Rev.A)
Board Software (Rev A)((http://www.ti.com/litv/zip/slac129a
http://www ti com/litv/zip/slac129a)
ThiscodeusessomeCsyntaxthatwehaventcovered.Feelfreetoaskmeifitisunclear.
Also
MSP430x4xxFamilyUsersGuidehttp://focus.ti.com/lit/ug/slau056j/slau056j.pdf
MSP430FG4618/F2013ExperimentersBoardUsersGuidehttp://focus.ti.com/lit/ug/slau213a/slau213a.pdf
SBCLDA4Specsheethttp://www.softbaugh.com/downloads/SBLCDA4_Specification.pdf