Quantcast
Channel: Forums - Recent Threads
Viewing all 262198 articles
Browse latest View live

UCC20225: Can we connect OUTA to High Side and OUTB to low side

$
0
0

Part Number:UCC20225

I want to use this IC to drive a SiC-based inverter. Can we connect OUTA to High Side and OUTB to low side for a DC link voltage up to 600 volts?

Regards

Manish


BUF20800-Q1: Please tell me about the characteristics of I2C

$
0
0

Part Number:BUF20800-Q1

Hello Expert.

Thank you for your special support every day.

I have two simple question about BUF20800-Q1 I2C.

①Is there a provision for I2C number of data rewrite times ?

②How long can this data be held on the I 2 C bus for this product ?

Please check and reply.

Best,Regars.

Fukazawa

TMS320F28377D: How to use the SFRA in 3 phase situation like ABC-DQ ?

$
0
0

Part Number:TMS320F28377D

Hi:

I want to use the SFRA in a 3-phase rectifier. I try to  optimize the voltage and the current loop.

The PWM ISR is 4k, but the data in SFRA1 update needs sevaral seconds. It seems like the functions run every ISR, but the data didnt update.

Is the SFRA only suitable for some special model ? So there is some arguments check failed, the function didnt run?

Can I simply use SFRA for a PID loop or 2P2Z only?

I know the SFRA is a .lib, is any possibility to  adjust the arguments for common use?

at last, is there any information about SFRA in ABC-DQ situation?

Thanks a lot !

DRV8842: the capacitor

$
0
0

Part Number:DRV8842

Hi

The customer concerns about the capacitor that is connected at CP1 and CP2 and VCP and V3P3OUT.

That is "How much max voltage should we estimate at the following capacitor?" and "How much capacitor is it acceptable for the capacitor? (+/- 50%? or less?)"

1. CP1 and CP2 : it should be VM voltage at least. And it need 0.01uF +/-50% accetable. (We need to consider DC bias specifications)

2. VCP : the charge pump voltag is ~11V. So that, 16V need at least. And 0.1uF +/-50% at least.

3. V3P3OUT: The internal LDO output is 3.3V. It is mentioned at datasheet as 0.47uF and 6.3V. Why does it need 6.3V? And how much does it need for this capacitor ? +/- 50% is needed ?

I referenced to the following post.

https://e2e.ti.com/support/motor-drivers/f/38/t/716344?tisearch=e2e-sitesearch&keymatch=DRV8818%20vgd

Best Regards,

Koji Hamamoto

AM4372: About the PDK QSPI driver S25FL.c

$
0
0

Part Number:AM4372

Hi all,

Souce :
PDK_INSTALL_PATH\ti\drv\spi\test\qspi_flash\src\Flash_S25FL\S25FL.c

We usually think that dummy reads are inserted before "data read",
In this program, dummy reads are inserted before "Write Address".
Is this a mistake in the program?

/* Write read command */
writeVal[0] = readCmd;
transaction.txBuf = (unsigned char *)&writeVal[0];
transaction.rxBuf = NULL;
transaction.count = 1;

transferType = SPI_TRANSACTION_TYPE_WRITE;
SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);
retVal = SPI_transfer(handle, &transaction);

/* Write dummy bits for fast read if required */
if(0 != numDummyBits)
{
writeVal[0] = 0U;
transaction.txBuf = (unsigned char *)&writeVal[0];
transaction.rxBuf = NULL;
transaction.count = (numDummyBits >> 3); /* In bytes */

transferType = SPI_TRANSACTION_TYPE_WRITE;
SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);
retVal = SPI_transfer(handle, &transaction);
}

/* Write Address Bytes */
/* *tempPtr = (unsigned int)srcAddr; */
/* transaction.txBuf = (unsigned char *)tempPtr; */
transaction.txBuf = (unsigned char *)srcAddr;
transaction.rxBuf = NULL;
transaction.count = addrLengthInBytes;

transferType = SPI_TRANSACTION_TYPE_WRITE;
SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);
retVal = SPI_transfer(handle, &transaction);

/* Read the actual flash data */
transaction.txBuf = NULL;
transaction.rxBuf = (unsigned char *)dstOffstAddr;
transaction.count = length;

Best regards,

sasaki

CC3220S-LAUNCHXL: What are the steps to convert to HTTPS?

AM5728: Does sitara support TSN and OPC UA on the same time?

$
0
0

Part Number:AM5728

Hi Team,

      Does sitara support TSN and OPC UA on the same time? If not, do we have this plan?

I know AM5728 support OPC UA and AM65xx support TSN. But I can't see a chip can support both. Do you have any suggestions?

Thanks!

BQ40Z50-R2: External Cell Balancing Connection for Cell 1

$
0
0

Part Number:BQ40Z50-R2

Dear TI Expert,

Refer to SLUA420A, figure 1. it is not clear what the gate of external FET for cell 1 connects to. Would it connect to VSS of the Q40z50? If that's the case, VSS of the IC would not be at the most negative voltage of the cell chain, which as I understand it would be undesirable, correct? Please refer to attached diagram.

Thanks,

Roberto


TMDSEVM572X: interafcing earphones with mic on am5728 GP EVM

$
0
0

Part Number:TMDSEVM572X

Hai,

i am using am5728 GP EVM. Is it possible to use earphones with mic that are used with smartphones. if it is possible i willing to know the steps to do it.

i have already enabled the dts file for audio codec and created nodes for Mcasp and created images to boot but i want to use the mic in earphones for audio input to the board through LINE IN audio jack(audio in jack on the board).

Best Regards,

Venkatesh R.

TLV320AIC3106: Audio levels not sufficient

$
0
0

Part Number:TLV320AIC3106

Hi Team,

One of our customer is using TLV320AIC3106 and need your support to validate the configuration settings .

While testing customer found Audio Levels are not sufficient and suspect the problem is with the configuration of Audio Codec and it is not giving proper Single Ended output. 

Need to configure the outputs to Single Ended with 0dB (or max) set at maximum volumes, want to configure following configuration but while writing the register values over I2C, we could not see respective change at the Audio Output from Codec. 

Used following commands: 

For setting the High-Power Output Driver Control Register, kindly use the below commands in UART terminal: 

$ i2cget -f 1 0x1b 0x26

              It displays the current value of the 0x26(Register 38)

$ i2cset -f 1 0x1b 0x26 0xc

              It sets expected value(0xc) in the 0x26(Register 38) (Please confirm if it is correct command to work).

 Below is the reference used from datasheet.

(Please visit the site to view this file)

Please help with your comments. Thanks in advance for your help and support.

Regards, Shinu Mathew.

 

 

 

 

ADS8339: MSB missing

$
0
0

Part Number:ADS8339

Dear teams,

Our customer using ADS8339 in his application. The VDD and Vref are all 5V. -IN is connected to GND. A 0-5V signal is connected to +IN. When the input signal is 0-2.5V, the ADC output signal is 0x0000-0xFFFF. However, when the input signal increased to 2.5V -5V, the ADC output signal is still 0x0000-0xFFFF. The MSB always 0, it doesn't change.

In the datasheet of ADS8339. It noticed: The device outputs the MSB of data on the first SCLK falling edge after the conversion is complete and continues to output the next lower data bits on every subsequent SCLK falling edge.

I don't know why the MSB always 0. If you have any idea about this question please let me know.

Regards,

Ricardo.

SN75DP130: we can’t adjust the vswing via Intel’s APPLET tool, it seems be limited by DP redriver.

$
0
0

Part Number:SN75DP130

Hi Alec,

Due to the whole DP SI compliance test that need to be measured under various mode.

However we can’t adjust the vswing via Intel’s APPLET tool, it seems be limited by DP redriver.

Does the DP redriver SN75DP130SSRGZR can adjust the vswing or not?

CCS/IWR1642BOOST: Use Indoor False Detection demo with IWR1642

$
0
0

Part Number:IWR1642BOOST

Tool/software: Code Composer Studio

Hello TI,

Can I  use Indoor False detection with IWR1642Boost EVM , Is it Work...?

If yes, what Changes i need to for IWR1642 

Thanks,

Rahul

CCS: If CCS can improve it's "Find in project" function

$
0
0

Tool/software: Code Composer Studio

Hi 

Here I just want to give my suggestion which I think it is very very very important to CCS which is compared with other IDEs.

That is the "Find in project" function!  This is very important for debug!

I know we can use use the right click the variable->Search text->Project, But it just can search the variable. I can't search a word I want to search freely like the search in IAR

Best regards

Gary

TCAN337: Under what conditions will keep RXD(No.4) terminal to high level?

$
0
0

Part Number:TCAN337

 Hello guys,

 One of our customers is in trouble with TCAN337. Could you please give me your advice or your help?

They are using the deivce for some car system. They sometimes observed RXD(No.4) terminal was kept to high level continuously. They want to know what conditions will keep RXD(No.4) terminal to high level continuously?

 Is the phenomenon occured by high level of S(No.8) terminal (Silent mode)? Or is there any other condition?

 Your reply would be much appreciated.

 Best regards,

 Kazuya Nakai.

 


IWR1642: How to calculate the peakval to db scale?

$
0
0

Part Number:IWR1642

Hi team,

My customer is asking about How to calculate the peakval to db scale?

He had got the peakval from UART data ouput. But he wants to know the calculation from peak value to db scale to match the 15db threshold in CFAR.

Could you please help to provide the equation about it? Thanks

Thanks.

Regards,

Wesley

Linux/TMS320DM368: SD High Speed Mode

$
0
0

Part Number:TMS320DM368

Tool/software: Linux

Hi,

I have a question with regard to SPRUFH5B Section 3.10 SD High Speed Mode.

Though the procedure to configure SD High speed mode is described, it is not clear to me if this is available in the PSP or it is something which I have to configure step by step as per the procedure.

I would appreciate if anyone could advise.

Thank you in advance.

Linux/AM5728: Comparing with TI Bench

$
0
0

Part Number:AM5728

Tool/software: Linux

Hi,

Using AM5728, How can i read DSP Freq(Hz) from a call in my App?

tried to use:

typedef struct Types_FreqHz {
            Bits32 hi;
            Bits32 lo;
        } Types_FreqHz;

"lo" returns 600 but "hi" returns nothing!

my point is to compare my DSP App with TI benchmark.

RTOS/CC1350: UART full duplex communication

$
0
0

Part Number:CC1350

Tool/software: TI-RTOS

Hi,

I want to implement the full duplex communication using UART driver. I want to run the UART_read() function running in while(1) in the separate task, meanwhile, I want to call UART_write asynchronously. Can I call the write () function when the same UART handle is used by the read() function in the background? I need more clarification regarding the handles.

Any help would be appreciated.

Thankyou 

--

Hari

CCS/MSP430FR6989: LCD Screen Project (Weird activation of buzzer and LED on connected BoosterPack EDUMKII)

$
0
0

Part Number:MSP430FR6989

Tool/software: Code Composer Studio

Hello I am trying to develop a project, (with my MSP430FR6989 Launchpad and the Educational BoosterPack MKII), where the LCD Screen OF the LAUNCHPAD will show an instruction and the user will have to do something based on that instruction. The LCD Screen works as expected. However, as soon as the LCD turns on, the Buzzer (of the BoosterPack) unexpectedly emits a high pitched sound and the LED on the BoosterPack turns bright green. I really don't want this to happen as I need the Buzzer and the LED for other stuff and this really messes up those goals. Can anyone explain possible reasons for this happening? I am including here the main.asm code, the myClocks.h and myClocksWithCrystals.c code (this has the initClocks), and the myLCD.c (which has the myLCD_init code) and myLCD.h code. In the actual project, I had also included the MSP430FR5xx_6xx lib). I could not find a way to include the entire zip file for the CCS project here so please let me know if you need to see any other code

main.asm

;-------------------------------------------------------------------------------
; MSP430 Assembler Code Template for use with TI Code Composer Studio
;
;
;-------------------------------------------------------------------------------
.cdecls C,LIST,"msp430.h" ; Include device header file

;--- external references -------------------------------------------------------
.ref initGPIO
.ref initClocks
.ref myLCD_init
.ref myLCD_showChar
;----variables -----------------------------------------------------------------
.bss Result, 2

;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.

;-------------------------------------------------------------------------------
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer


;-------------------------------------------------------------------------------
; Main loop here
;-------------------------------------------------------------------------------
UnlockGPIO bic.w #LOCKLPM5,&PM5CTL0
calla #initGPIO
calla #initClocks
calla #myLCD_init

mov.w #'R', R12
mov.w #1, R13
calla #myLCD_showChar

mov.w #2, R13
mov.w #'E', R12
calla #myLCD_showChar

mov.w #4, R13
mov.w #'F', R12
calla #myLCD_showChar

mov.w #3, R13
mov.w #'5', R12
;add.w #0x7, R12
calla #myLCD_showChar

;mov.w #5, R13
;mov.w #'', R12
;calla #myLCD_showChar

mov.w &Result, R15

end: jmp end

;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
.global __STACK_END
.sect .stack

;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET

myClocksWithCrystals.c

// ----------------------------------------------------------------------------
// myClocksWithCrystals.c ('FR6989 Launchpad)
// ----------------------------------------------------------------------------
// This routine sets up the Low Frequency crystal (LFXT) and high-freq
// internal clock source (DCO). Then configures ACLK, SMCLK, and MCLK:
//
// Oscillators:
// LFXT = 32KHz External crystal input
// DCO = 4MHz (default is 1MHz) Internal high-frequency oscillator
//
// Internal Clocks:
// ACLK = 32KHz (uses LFXT external oscillator)
// SMCLK = 2MHz (uses DCO internal oscillator)
// MCLK = 4MHz (uses DCO internal oscillator)
// ----------------------------------------------------------------------------

//***** Header Files **********************************************************
#include <stdbool.h>
#include <driverlib.h>
#include "myClocks.h"


//***** Defines ***************************************************************
// See additional #defines in 'myClocks.h'
#define XT_TIMEOUT 100000


//***** Global Variables ******************************************************
uint32_t myACLK = 0;
uint32_t mySMCLK = 0;
uint32_t myMCLK = 0;

uint8_t returnValue = 0;
bool bReturn = STATUS_FAIL;


//***** initClocks ************************************************************
void initClocks(void) {

//**************************************************************************
// Configure Oscillators
//**************************************************************************
// Set the crystal frequencies attached to the LFXT and HFXT oscillator pins
// so that driverlib knows how fast they are (needed for the clock 'get' functions)
CS_setExternalClockSource(
LF_CRYSTAL_FREQUENCY_IN_HZ,
HF_CRYSTAL_FREQUENCY_IN_HZ
);

// Verify if the default clock settings are as expected
myACLK = CS_getACLK();
mySMCLK = CS_getSMCLK();
myMCLK = CS_getMCLK();

// Initialize the LFXT crystal oscillator (using a timeout in case there is a problem with the crystal)
// - This requires PJ.4 and PJ.5 pins to be connected (and configured) as "crystal" pins.
// - Another alternative is to use the non-timeout function which "hangs" if LFXT isn't configured:
// CS_turnOnLFXT( CS_LFXT_DRIVE_0 );
// - The "WithTimeout" function used here will always exit, even if LFXT fails to initialize.
// You must check to make sure LFXT was initialized properly... in a real application, you would
// usually replace the while(1) with a more useful error handling function.
bReturn = CS_turnOnLFXTWithTimeout(
CS_LFXT_DRIVE_0,
XT_TIMEOUT
);

if ( bReturn == STATUS_FAIL )
{
while( 1 );
}


// // Initialize HFXT. Returns STATUS_SUCCESS if initializes successfully.
// // The FR6989 Launchpad does not ship with HF crystal, so we've left it commented-out.
// bReturn = CS_turnOnHFXTWithTimeout(
// CS_HFXTDRIVE_4MHZ_8MHZ,
// XT_TIMEOUT
// );
//
// if ( bReturn == STATUS_FAIL )
// {
// while( 1 );
// }

// Set FRAM Controller waitstates to 1 when MCLK > 8MHz (per datasheet)
// Please refer to the "Non-Volatile Memory" chapter for more details
//FRAMCtl_configureWaitStateControl( FRAMCTL_ACCESS_TIME_CYCLES_1 );

// Set DCO to run at 4MHz
CS_setDCOFreq(
CS_DCORSEL_0, // Set Frequency range (DCOR)
CS_DCOFSEL_3 // Set Frequency (DCOF)
);

//**************************************************************************
// Configure Clocks
//**************************************************************************
// Set ACLK to use LFXT as its oscillator source (32KHz)
// With a 32KHz crystal and a divide by 1, ACLK should run at that rate
CS_initClockSignal(
CS_ACLK, // Clock you're configuring
CS_LFXTCLK_SELECT, // Clock source
CS_CLOCK_DIVIDER_1 // Divide down clock source by this much
);

// Set SMCLK to use DCO as its oscillator source (DCO was configured earlier in this function for 4MHz)
// With DCO set at 4MHz, SMCLK is set for half that rate (2MHz)
CS_initClockSignal(
CS_SMCLK, // Clock you're configuring
CS_DCOCLK_SELECT, // Clock source
CS_CLOCK_DIVIDER_2 // Divide down clock source by this much
);

// Set MCLK to use DCO as its oscillator source (DCO was configured earlier in this function for 4MHz)
CS_initClockSignal(
CS_MCLK, // Clock you're configuring
CS_DCOCLK_SELECT, // Clock source
CS_CLOCK_DIVIDER_1 // Divide down clock source by this much
);

// Verify that the modified clock settings are as expected
myACLK = CS_getACLK();
mySMCLK = CS_getSMCLK();
myMCLK = CS_getMCLK();
}

myLCD.c

// ----------------------------------------------------------------------------
// myLCD.c ('FR6989 LaunchPad)
// ----------------------------------------------------------------------------

// ***** Header Files *********************************************************
#include "myLcd.h"
#include "string.h"
#include "driverlib.h"


// ***** Prototypes ***********************************************************
// See additional prototypes in the 'myLCD.h' file
void TEST_myLCD_showSymbol( void );


// ***** Global Variables******************************************************
// Memory locations for LCD characters
const uint8_t SegmentLoc[ LCD_NUM_CHAR ][ 4 ] =
{
{ 18, 19, 20, 21 }, // Position 1 = Digit A1
{ 10, 11, 12, 13 }, // Position 2 = Digit A2
{ 6, 7, 8, 9 }, // Position 3 = Digit A3
{ 36, 37, 38, 39 }, // Position 4 = Digit A4
{ 28, 29, 30, 31 }, // Position 5 = Digit A5
{ 14, 15, 16, 17 } // Position 6 = Digit A6
};

// LCD memory map for numeric digits
const char digit[10][2] =
{
{0xFC, 0x28}, /* "0" LCD segments a+b+c+d+e+f+k+q */
{0x60, 0x20}, /* "1" */
{0xDB, 0x00}, /* "2" */
{0xF3, 0x00}, /* "3" */
{0x67, 0x00}, /* "4" */
{0xB7, 0x00}, /* "5" */
{0xBF, 0x00}, /* "6" */
{0xE4, 0x00}, /* "7" */
{0xFF, 0x00}, /* "8" */
{0xF7, 0x00} /* "9" */
};

// LCD memory map for uppercase letters
const char alphabetBig[26][2] =
{
{0xEF, 0x00}, /* "A" LCD segments a+b+c+e+f+g+m */
{0xF1, 0x50}, /* "B" */
{0x9C, 0x00}, /* "C" */
{0xF0, 0x50}, /* "D" */
{0x9F, 0x00}, /* "E" */
{0x8F, 0x00}, /* "F" */
{0xBD, 0x00}, /* "G" */
{0x6F, 0x00}, /* "H" */
{0x90, 0x50}, /* "I" */
{0x78, 0x00}, /* "J" */
{0x0E, 0x22}, /* "K" */
{0x1C, 0x00}, /* "L" */
{0x6C, 0xA0}, /* "M" */
{0x6C, 0x82}, /* "N" */
{0xFC, 0x00}, /* "O" */
{0xCF, 0x00}, /* "P" */
{0xFC, 0x02}, /* "Q" */
{0xCF, 0x02}, /* "R" */
{0xB7, 0x00}, /* "S" */
{0x80, 0x50}, /* "T" */
{0x7C, 0x00}, /* "U" */
{0x0C, 0x28}, /* "V" */
{0x6C, 0x0A}, /* "W" */
{0x00, 0xAA}, /* "X" */
{0x00, 0xB0}, /* "Y" */
{0x90, 0x28} /* "Z" */
};

// This structure is defined by the LCD_C DriverLib module, and is passed to the LCD_C_init() function
LCD_C_initParam initParams = {
LCD_C_CLOCKSOURCE_ACLK, // Use ACLK as the LCD's clock source
LCD_C_CLOCKDIVIDER_1,
LCD_C_CLOCKPRESCALAR_16,
LCD_C_4_MUX, // LaunchPad LCD specifies 4MUX mode
LCD_C_LOW_POWER_WAVEFORMS,
LCD_C_SEGMENTS_ENABLED
};


//*****************************************************************************
// myLCD_init()
//
// Configures the LCD display controller, and then clears the display and
// enables it
//*****************************************************************************
void myLCD_init()
{
// Turn off LCD
LCD_C_off( LCD_C_BASE );

// L0~L26 & L36~L39 pins selected for use with LCD
// Note: LCD pin configurations override any GPIO settings for these pins
LCD_C_setPinAsLCDFunctionEx( LCD_C_BASE, // Gives range of pins to LCD controller
LCD_C_SEGMENT_LINE_0, // Starting Lx pin of range
LCD_C_SEGMENT_LINE_21 // Ending pin of range
);

LCD_C_setPinAsLCDFunctionEx( LCD_C_BASE, // Gives range of pins to LCD controller
LCD_C_SEGMENT_LINE_26, // Starting Lx pin of range
LCD_C_SEGMENT_LINE_43 // Ending pin of range
);

// Init LCD as 4-mux mode
LCD_C_init( LCD_C_BASE, &initParams );

// LCD Operation - VLCD generated internally, V2-V4 generated internally, v5 to ground
LCD_C_setVLCDSource( LCD_C_BASE, LCD_C_VLCD_GENERATED_INTERNALLY,
LCD_C_V2V3V4_GENERATED_INTERNALLY_NOT_SWITCHED_TO_PINS,
LCD_C_V5_VSS );

// Set VLCD voltage
// LCD_C_setVLCDVoltage( LCD_C_BASE, LCD_C_CHARGEPUMP_VOLTAGE_3_02V_OR_2_52VREF );

// Enable charge pump and select internal reference for it
LCD_C_enableChargePump( LCD_C_BASE );
LCD_C_selectChargePumpReference( LCD_C_BASE,
LCD_C_INTERNAL_REFERENCE_VOLTAGE );

LCD_C_configChargePump( LCD_C_BASE, LCD_C_SYNCHRONIZATION_ENABLED, 0 );

// Clear LCD memory
// LCD_C_clearMemory( LCD_C_BASE );
// LCD_C_clearBlinkingMemory( LCD_C_BASE );

// Select to display main LCD memory
LCD_C_selectDisplayMemory( LCD_C_BASE, LCD_C_DISPLAYSOURCE_MEMORY );

// Turn blinking features off
LCD_C_setBlinkingControl( LCD_C_BASE, LCDBLKPRE1, LCDBLKPRE2, LCD_C_BLINK_MODE_DISABLED );

// Turn on LCD
LCD_C_on( LCD_C_BASE );

// ----------------------------------------------------------------------------
// Test Routines
// ----------------------------------------------------------------------------
//Runs the routine which tests all the options for the myLCD_showSymbol() function
//TEST_myLCD_showSymbol();

// Test other functions
//myLCD_showChar( 'A', 1 );
//myLCD_showChar( 'B', 2 );
//myLCD_showChar( 'C', 3 );
//myLCD_showChar( 'D', 4 );
//myLCD_showChar( 'E', 5 );
//myLCD_showChar( 'F', 6 ); // Display should show "ABCDEF"

//myLCD_displayNumber( 123456 ); // Display should show "123456"
//myLCD_displayNumber( 1111111 ); // Display should show " ERROR"
}


//*****************************************************************************
// myLCD_showChar()
//
// Displays input character at given LCD digit/position
// Only spaces, numeric digits, and uppercase letters are accepted characters
//
// This function has two arguments and does not return a value.
//
// Arg 1: "c" is a string char that you want displayed on the LCD glass.
// Currently, only A-Z and 0-9 and a space " " are supported. You can
// clear any character position by using the space.
// Arg 2: "Position" tells the function where you want the character to be
// placed. With six character positions, they're specified in this
// order: 1 2 3 4 5 6
//
// This routine converts the provided string character to an offset into a
// lookup table, which provides the values to turn each character's
// segments on/off.
//
// The Position number is used to lookup locations for each nibble that
// controls a segment pin. Four nibbles are required per character.
//
// This routine uses the native LCD_C DriverLib "setMemory" functions. The
// LCD_C version of this routine only programs a nibble at a time, as opposed
// to the LCD_E_setMemory(), which programs the entire 8-bit LCDMEM register.
// See the examples found later in this file for an example which is closer
// to the LCD_E method. We called our example: myLCD_setMemoryBits().
//*****************************************************************************
void myLCD_showChar( char c, int Position )
{
Position -= 1;

if ( ( Position >= 0 ) && ( Position <= 6 ) )
{

if ( c == ' ' )
{
// Display space
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][0], 0 );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][1], 0 );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][2], 0 );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][3], 0 );
}
else if ( c >= '0' && c <= '9' )
{
// Display digit
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][0], digit[c-48][0] );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][1], digit[c-48][0] >> 4 );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][2], digit[c-48][1] );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][3], digit[c-48][1] >> 4 );
}
else if ( c >= 'A' && c <= 'Z' )
{
// Display alphabet
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][0], alphabetBig[c-65][0] );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][1], alphabetBig[c-65][0] >> 4 );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][2], alphabetBig[c-65][1] );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][3], alphabetBig[c-65][1] >> 4 );
}
else
{
// Turn all segments on if character is not a space, digit, or uppercase letter
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][0], 0xFF );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][1], 0xFF );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][2], 0xFF );
LCD_C_setMemory( LCD_C_BASE, SegmentLoc[Position][3], 0xFF );
}
}
}

//*****************************************************************************
// myLCD_displayNumber()
//
// Displays a right-aligned number on the display. This function takes one
// input value and does not return a value.
//
// Arg 1: "val" is the integer to be displayed. It must be less than 6 digits
// in length or this function writes "ERROR". The number is first
// converted into character equivalants, then displayed.
//
// This function does not provide any 'punctuation'. That is, decimals, signs
// or colons. You could add these using the myLCD_showSymbol() function.
//*****************************************************************************
void myLCD_displayNumber( unsigned long val )
{
unsigned long div[6];
unsigned long mod[6];
unsigned long err;

err = val / 1000000;
if ( err > 0 )
{
myLCD_showChar( ' ', 1 );
myLCD_showChar( 'E', 2 );
myLCD_showChar( 'R', 3 );
myLCD_showChar( 'R', 4 );
myLCD_showChar( 'O', 5 );
myLCD_showChar( 'R', 6 );
}
else
{
div[0] = val / 100000 ;
mod[0] = val % 100000 ;
div[1] = mod[0] / 10000;
mod[1] = mod[0] % 10000;
div[2] = mod[1] / 1000 ;
mod[2] = mod[1] % 1000 ;
div[3] = mod[2] / 100 ;
mod[3] = mod[2] % 100 ;
div[4] = mod[3] / 10 ;
div[5] = mod[3] % 10 ;

int i = 0;
int LeadingZeros = 0;

for ( i = 0; i < ( LCD_NUM_CHAR - 1); i++ )
{
if ( ( div[i] == 0 ) && ( !LeadingZeros ) )
{
myLCD_showChar( ' ', i + 1 );
}
else
{
myLCD_showChar( div[i] + '0', i + 1 );
LeadingZeros++;
}
}

i = LCD_NUM_CHAR - 1;
myLCD_showChar( div[i] + '0', i + 1 );
}
}

//*****************************************************************************
// TEST_myLCD_showSymbol()
//
// Provides a single function which tests every mode of the myLCD_showSymbol()
// function. You should be able to verify it's correct operation using with
// this function - along with use of breakpoints, single-stepping and a little
// manipulation of the LCD memory in the CCS Registers window.
//*****************************************************************************
void TEST_myLCD_showSymbol( void )
{
int i; // Iterates thru Operations
int j; // Iterates thru Symbols
int m; // Iterates thru Memories
volatile int r = -1; // Let's you view the return value (volatile needed to compiler won't optimize it away)

for ( m = 0; m < 2; m++ )
{
if ( m == 1 )
{
LCD_C_selectDisplayMemory( LCD_C_BASE, LCD_C_DISPLAYSOURCE_BLINKINGMEMORY );
}
else
{
LCD_C_selectDisplayMemory( LCD_C_BASE, LCD_C_DISPLAYSOURCE_MEMORY );
}

for ( i = 0; i <= 3; i++ )
{
for ( j = 0; j <= LCD_A4COL; j++ )
{
r = myLCD_showSymbol( i, j, m );
}
}
}

// Clear LCD memory and restore to display to main LCD memory
LCD_C_selectDisplayMemory( LCD_C_BASE, LCD_C_DISPLAYSOURCE_MEMORY );
LCD_C_clearMemory( LCD_C_BASE );
LCD_C_clearBlinkingMemory( LCD_C_BASE );
}

//*****************************************************************************
// myLCD_showSymbol()
//
// The function shows (or modifies) the LCD memory bits to control the various
// special icons (i.e. non-character segments) of the display.
//
// This function has three arguments and returns either '0' or '1'.
//
// Return - reflects the value of the icon's segment enable bit
// at the end of the function
// Arg 1 - 'Operation' specifies on of 4 different functions
// that can be performed on an icon
// Arg 2 - 'Symbol' indicates the special icon segment operated upon
// Arg 3 - 'Memory' specifies which LCD memory (main or blinking)
// the function should modify or test
//
// Operation: The function can perform 4 different functions on each icon:
//
// LCD_UPDATE - sets the segment bit to enable the icon
// LCD_CLEAR - clears the icon's segment bit
// LCD_TOGGLE - toggles the icon's segment bit
// LCD_GET - returns the value of the icon's segment bit
//
// Additionally, all operations return the icon's segment bit value.
// For UPDATE, this should always be '1'; and for CLEAR, this should
// be '0'; the others will vary based on the current value (GET) or
// new value (TOGGLE).
//
// Symbol: The 'icon' value is used to select which LCD memory register
// and bit to operate upon.
//
// Memory: Determines which LCD memory to act upon. '0'
// represents the Main LCD memory registers; while '1' represents
// the Blinking LCD memory registers. This allows a single
// function to perform all the possible operations for a segment.
//
// The associated header file enumerates these operations as well as the various
// icons found on this LCD.
//*****************************************************************************
int myLCD_showSymbol( int Operation, int Symbol, int Memory )
{
int idx = 0; // Specifies the index of the LCD memory register (i.e. x in LCDMx)
int bit = 0; // Specifies the charachters bit within the LCD memory register
int mem = 0; // Offset for LCD's "main" or "blinking" memory registers (either 0 or 32)
int ret = -1; // Holds the function's return value

// Which Memory has the user specified? 'Main' or 'Blinking'
// Since 'Blinking' only applies to MUX4 (and lower) configurations, we ignore the Memory field if it does not apply.
// This function cheats - instead of using LCDMx (for main) or LCDBMx (for blinking), we cheated and made use of the fact that the
// two sets of LCD memory registers are aliased. Therefore, setting LCDBM3 also sets LCDM35.
// Note, we made 'initParams' a global variable to make this test easier; though, we could have also tested the LCD register itself.
if (( initParams.muxRate <= LCD_C_4_MUX ) && ( Memory == 1 ))
mem = 35-3; // Writing to LCDBM35 also sets LCDM3 (and so on with the other values)

// Select the LCDM memory register index (idx) and bit depending upon the provided Symbol value
switch ( Symbol )
{
case LCD_TMR:
idx = LCD_TIMER_IDX;
bit = LCD_TIMER_COM;
break;
case LCD_HRT:
idx = LCD_HEART_IDX;
bit = LCD_HEART_COM;
break;
case LCD_REC:
idx = LCD_REC_IDX;
bit = LCD_REC_COM;
break;
case LCD_EXCLAMATION:
idx = LCD_EXCLAMATION_IDX;
bit = LCD_EXCLAMATION_COM;
break;
case LCD_BATT:
idx = LCD_BATT_IDX;
bit = LCD_BATT_COM;
break;
case LCD_BRACKETS:
idx = LCD_BRACKETS_IDX;
bit = LCD_BRACKETS_COM;
break;
case LCD_B6:
idx = LCD_B6_IDX;
bit = LCD_B6_COM;
break;
case LCD_B5:
idx = LCD_B5_IDX;
bit = LCD_B5_COM;
break;
case LCD_B4:
idx = LCD_B4_IDX;
bit = LCD_B4_COM;
break;
case LCD_B3:
idx = LCD_B3_IDX;
bit = LCD_B3_COM;
break;
case LCD_B2:
idx = LCD_B2_IDX;
bit = LCD_B2_COM;
break;
case LCD_B1:
idx = LCD_B1_IDX;
bit = LCD_B1_COM;
break;
case LCD_ANT:
idx = LCD_ANT_IDX;
bit = LCD_ANT_COM;
break;
case LCD_TX:
idx = LCD_TX_IDX;
bit = LCD_TX_COM;
break;
case LCD_RX:
idx = LCD_RX_IDX;
bit = LCD_RX_COM;
break;
case LCD_NEG:
idx = LCD_NEG_IDX;
bit = LCD_NEG_COM;
break;
case LCD_DEG:
idx = LCD_DEG_IDX;
bit = LCD_DEG_COM;
break;
case LCD_A1DP:
idx = LCD_A1DP_IDX;
bit = LCD_A1DP_COM;
break;
case LCD_A2DP:
idx = LCD_A2DP_IDX;
bit = LCD_A2DP_COM;
break;
case LCD_A3DP:
idx = LCD_A3DP_IDX;
bit = LCD_A3DP_COM;
break;
case LCD_A4DP:
idx = LCD_A4DP_IDX;
bit = LCD_A4DP_COM;
break;
case LCD_A5DP:
idx = LCD_A5DP_IDX;
bit = LCD_A5DP_COM;
break;
case LCD_A2COL:
idx = LCD_A2COL_IDX;
bit = LCD_A2COL_COM;
break;
case LCD_A4COL:
idx = LCD_A4COL_IDX;
bit = LCD_A4COL_COM;
break;
default:
break;
}

// This switch acts upon the correct icon segment based upon the Operation specified by the user
switch ( Operation )
{
case LCD_UPDATE:
LCDMEM[ idx - 1 + mem ] |= bit;
break;
case LCD_CLEAR:
LCDMEM[ idx - 1 + mem ] &= ~bit;
break;
case LCD_TOGGLE:
LCDMEM[ idx - 1 + mem ] ^= bit;
break;
}

// The LCD_GET operation is always performed; this is what is returned by the function
if ( ( LCDMEM[ idx - 1 + mem ] & bit ) >> 0 )
{
ret = 1;
}
else
{
ret = 0;
}

return ( ret );
}


//*****************************************************************************
// The LCD_C and LCD_E Driver Library modules vary in their implementations. In
// this case, it's not a difference in hardware, but with the fact that some of
// the routines, such as _setMemory(), were improved in the later LCD_E module.
//
// We created a new set of functions here for LCD_C that better match those
// found in the LCD_E implementation. Along with our "myLCD" precursor, we also
// differentiated these functions by adding "Bits" to the end of the function
// names. For example, myLCD_setMemoryBits().
//*****************************************************************************
void myLCD_setMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Set byte-wide LCD Memory with 8-bit SegmentMask
{
LCDMEM[ LcdMemIndex - 1 ] = SegmentMask; // 'Set' replaces the LCD memory value with the provided mask
}

void myLCD_setBlinkingMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Set byte-wide LCD Memory with 8-bit SegmentMask
{
LCDBMEM[ LcdMemIndex - 1 ] = SegmentMask; // 'Set' replaces the LCD memory value with the provided mask
}

void myLCD_updateMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Update LCD Memory with 8-bit SegmentMask
{
LCDMEM[ LcdMemIndex - 1 ] |= SegmentMask; // 'Update' OR's the 8-bit mask with the current LCD memory value
}

void myLCD_updateBlinkingMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Update LCD Memory with 8-bit SegmentMask
{
LCDBMEM[ LcdMemIndex - 1 ] |= SegmentMask; // 'Update' OR's the 8-bit mask with the current LCD memory value
}

void myLCD_clearMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Clear specified SegmentMask bits of LCD Memory
{
LCDMEM[ LcdMemIndex - 1 ] &= ~SegmentMask; // 'Clear' AND's the inverse of the provided 8-bit mask
}

void myLCD_clearBlinkingMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Clear specified SegmentMask bits of LCD Memory
{
LCDBMEM[ LcdMemIndex - 1 ] &= ~SegmentMask; // 'Clear' AND's the inverse of the provided 8-bit mask
}

void myLCD_toggleMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Toggle the bits specified by the 8-bit SegmentMask
{
LCDMEM[ LcdMemIndex - 1 ] ^= SegmentMask; // 'Toggle' exclusive-OR's the mask bits within the specified LCD memory location
}

void myLCD_toggleBlinkingMemoryBits( uint8_t LcdMemIndex , uint8_t SegmentMask ) // Toggle the bits specified by the 8-bit SegmentMask
{
LCDBMEM[ LcdMemIndex - 1 ] ^= SegmentMask; // 'Toggle' exclusive-OR's the mask bits within the specified LCD memory location
}

uint8_t myLCD_getMemoryBits( uint8_t LcdMemIndex ) // Get the byte-wide LCD Memory location
{
return( LCDMEM[ LcdMemIndex - 1 ] ); // 'Get' returns the current value of the specified LCD memory location
}

uint8_t myLCD_getBlinkingMemoryBits( uint8_t LcdMemIndex ) // Get the byte-wide LCD Memory location
{
return( LCDBMEM[ LcdMemIndex - 1 ] ); // 'Get' returns the current value of the specified LCD memory location
}

myClocks.h

/*
* myClocks.h
*
*/

#ifndef MYCLOCKS_H_
#define MYCLOCKS_H_

//***** Prototypes ************************************************************
void initClocks(void);

//***** Defines ***************************************************************
#define LF_CRYSTAL_FREQUENCY_IN_HZ 32768
#define HF_CRYSTAL_FREQUENCY_IN_HZ 0 // FR6989 Launchpad does not ship with HF Crystal populated

#define myMCLK_FREQUENCY_IN_HZ 4000000
#define mySMCLK_FREQUENCY_IN_HZ 2000000
#define myACLK_FREQUENCY_IN_HZ 32768


#endif /* MYCLOCKS_H_ */

myLCD.h

/*
* myLcd.h
*
*/

//***** Header Files **********************************************************
#include "stdint.h"
#include <msp430fr6989.h>

#ifndef MYLCD_H_
#define MYLCD_H_

//***** Prototypes ************************************************************
void myLCD_init(void);
void myLCD_showChar( char, int );
void myLCD_displayNumber( unsigned long );
int myLCD_showSymbol( int, int, int );

// Prototypes for DriverLib alternative functions
void myLCD_setMemoryBits ( uint8_t, uint8_t ); // Set byte-wide LCD Memory with 8-bit SegmentMask
void myLCD_updateMemoryBits( uint8_t, uint8_t ); // Update LCD Memory with 8-bit SegmentMask
void myLCD_clearMemoryBits ( uint8_t, uint8_t ); // Clear specified SegmentMask bits of LCD Memory
void myLCD_toggleMemoryBits( uint8_t, uint8_t ); // Toggle the bits specified by the 8-bit SegmentMask
uint8_t myLCD_getMemoryBits ( uint8_t ); // Get the byte-wide LCD Memory location

void myLCD_setBlinkingMemoryBits ( uint8_t, uint8_t );
void myLCD_updateBlinkingMemoryBits( uint8_t, uint8_t ); // Update LCD Blinking Memory with 8-bit SegmentMask
void myLCD_clearBlinkingMemoryBits ( uint8_t, uint8_t ); // Clear specified SegmentMask bits of LCD Blinking Memory
void myLCD_toggleBlinkingMemoryBits( uint8_t, uint8_t ); // Toggle the bits specified by the 8-bit SegmentMask
uint8_t myLCD_getBlinkingMemoryBits ( uint8_t ); // Get the byte-wide LCD Blinking Memory location


//***** Defines ***************************************************************
#define LCD_NUM_CHAR 6 // Number of character positions in the display

/* LCD Symbol Bits */
#define LCD_HEART_IDX 3
#define LCD_HEART_SEG LCD_C_SEGMENT_LINE_4
#define LCD_HEART_COM BIT2

#define LCD_TIMER_IDX 3
#define LCD_TIMER_SEG LCD_C_SEGMENT_LINE_4
#define LCD_TIMER_COM BIT3

#define LCD_REC_IDX 3
#define LCD_REC_COM BIT1

#define LCD_EXCLAMATION_IDX 3
#define LCD_EXCLAMATION_COM BIT0

#define LCD_BRACKETS_IDX 18
#define LCD_BRACKETS_COM BIT4

#define LCD_BATT_IDX 14
#define LCD_BATT_COM BIT4

#define LCD_B1_IDX 18
#define LCD_B1_COM BIT5

#define LCD_B2_IDX 14
#define LCD_B2_COM BIT5

#define LCD_B3_IDX 18
#define LCD_B3_COM BIT6

#define LCD_B4_IDX 14
#define LCD_B4_COM BIT6

#define LCD_B5_IDX 18
#define LCD_B5_COM BIT7

#define LCD_B6_IDX 14
#define LCD_B6_COM BIT7

#define LCD_ANT_IDX 5
#define LCD_ANT_COM BIT2

#define LCD_TX_IDX 9
#define LCD_TX_COM BIT2

#define LCD_RX_IDX 9
#define LCD_RX_COM BIT0

#define LCD_NEG_IDX 11
#define LCD_NEG_COM BIT2

#define LCD_DEG_IDX 16
#define LCD_DEG_COM BIT2

#define LCD_A1DP_IDX 11
#define LCD_A1DP_COM BIT0

#define LCD_A2DP_IDX 7
#define LCD_A2DP_COM BIT0

#define LCD_A3DP_IDX 5
#define LCD_A3DP_COM BIT0

#define LCD_A4DP_IDX 20
#define LCD_A4DP_COM BIT0

#define LCD_A5DP_IDX 16
#define LCD_A5DP_COM BIT0

#define LCD_A2COL_IDX 7
#define LCD_A2COL_COM BIT2

#define LCD_A4COL_IDX 20
#define LCD_A4COL_COM BIT2

//***** myLCD_showSymbol() function operations
#define LCD_UPDATE 0
#define LCD_CLEAR 1
#define LCD_TOGGLE 2
#define LCD_GET 3

//***** myLCD_showSymbol() function memory enums
#define LCD_MEMORY_MAIN 0
#define LCD_MEMORY_BLINKING 1

//***** myLCD_showSymbol() function icons (for 'FR6989 LaunchPad)
#define LCD_TMR 0
#define LCD_HRT 1
#define LCD_REC 2
#define LCD_EXCLAMATION 3
#define LCD_BRACKETS 4
#define LCD_BATT 5
#define LCD_B1 6
#define LCD_B2 7
#define LCD_B3 8
#define LCD_B4 9
#define LCD_B5 10
#define LCD_B6 11
#define LCD_ANT 12
#define LCD_TX 13
#define LCD_RX 14
#define LCD_NEG 15
#define LCD_DEG 16
#define LCD_A1DP 17
#define LCD_A2DP 18
#define LCD_A3DP 19
#define LCD_A4DP 20
#define LCD_A5DP 21
#define LCD_A2COL 22
#define LCD_A4COL 23

//***** Global Variables ******************************************************
extern const char digit[10][2]; // Segment values for each number character
extern const char alphabetBig[26][2]; // Segment values for each alphabet character


#endif /* MYLCD_H_ */

 

 

 

Viewing all 262198 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>