biza

Members
  • Content count

    50
  • Joined

  • Last visited

About biza

  • Rank
    Level 1

Recent Profile Visitors

177 profile views
  1. Hello Friends, Now I facing some problems with getting correct readings of ADC ports in MSP432. I Am using a multimeter to get the viability of the correct process. I am using CCS 7.0 and CMSIS mode writing code. My question... it's normal the measurements not be stable? I am using P5.5 pin port (A0) and this pin have different values of voltage, or any time change the value. It' is normal? I leave my code for get the readings for the ADC. #include "msp.h" /*DEFINE VAR LIKE A INTEGER*/ volatile int value_adc; void ADC_Initialize(void){ /*CONFIGURE LED OUTPUT*/ P1->OUT &= ~BIT0; /*CLEAR LEAD OUTPUT */ P1->DIR |= BIT0; /*SET DIRECTION OUTPUT*/ /*ADC CONFIGURATION*/ P5->SEL1 &= ~BIT5; /*CONFIGURE P5.5 (A0) FOR ADC*/ P5->SEL0 |= BIT5; /*ENABLE GLOBAL INTERRUPTS*/ __enable_irq(); NVIC->ISER[0] = 1 << ((ADC14_IRQn) & 31); /*ENABLE ADC INTERRUPT IN NVIC MODULE*/ ADC14->CTL0 &= ~ADC14_CTL0_ENC; /*CONFIGURE ADC14*/ ADC14->CTL0 = ADC14_CTL0_SHT0_2 | ADC14_CTL0_SHP | ADC14_CTL0_ON; /*ADC14 ON | S&H=16 | SAMPLING TIME*/ ADC14->CTL1 = ADC14_CTL1_RES_3; /*USE SAMPLE TIME, 14 BIT'S CONVERSION RESULTS*/ ADC14->MCTL[0] |= ADC14_MCTLN_INCH_0; /*A0 ADC INPUT SELECT Vref=AVCC*/ ADC14->IER0 |= ADC14_IER0_IE0; /*ENABLE ADC CONVERT COMPLETE INTERRUPT*/ SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk; } void ADC_Task(void){ volatile unsigned int i; //P1->OUT ^= BIT0; for (i = 200000; i > 0; i--); /*DELAY CYCLE*/ ADC14->CTL0 |= ADC14_CTL0_ENC | ADC14_CTL0_SC; /*ENABLE CONVERTION | SAMPLING CONVERSION*/ __sleep(); __no_operation(); } void ADC14_IRQHandler(void) { // if(ADC14->MEM[0] >= 0x7FF){ /*CONVERT DE SIGN OF CONVERTION IN A VARIABLE*/ value_adc = ADC14->MEM[0]; LCD_SetInt(value_adc,12 ,0); printf(value_adc); /*VERIFY IF THE INPUT PINS IS SET TO*/ //while(ADC14->CTL0 & ADC14_CTL0_BUSY); /*VOLTAGE CALCULATIONS*/ //value_vol = (value_adc * Vref_1)/digitalValue_1; // sprintf(adcData,"%2.2f",value_vol); // LCD_SetText(adcData,6 ,0); // temp = value_vol/gradeTemp; // sprintf(TEMP_C,"%2.2f",temp); // LCD_SetText(TEMP_C,0 ,0); //LCD_SetText(TEMP_C,0 ,0); /*CURRENT*/ // UART_Task(adcData,TEMP_C); /* if(value_adc > newValue_Adc){ P1->OUT |= BIT0; }else{ P1->OUT &= ~BIT0; }*/ //}else{ // LCD_SetText("ERROR",6 ,0); //} }
  2. Hello NurseBob, Sorry for the delay, but I've been sick. I send you the data of the connections, for LCD and SDcard, PORT | PIN conections. MSP432------------------>LCD MSP432------------------>SDcard J4 J1 P2.6----------------------->D4 P1.5------------------>CLK P2.4----------------------->D5 P4.6------------------>CS/SS P5.6----------------------->D6 J2 P6.6----------------------->D7 P1.6------------------>MOSI P2.3----------------------->E P1.7------------------>MISO P6.7----------------------->RS The SDcard board:
  3. Hello NurseBob, sorry, i forgot to say what dispositive who am using, yes is the MSP432. But I not using the booster pack, its a simple arduino shield to SDcard, i really do a schema to share with you. This code have a LCD conection too.
  4. Hello people, I'am trying use a SDCARD only to regist data. All my project was made with "MSPClassic Registers", so I saw in the forum a Bluehash post, but was in CMSIS, in mode to satisfy my project I try to change some files. Now I have some problems to finish him there is someone who can help me?I need Something very simple, just confirm if the card is loaded or not and save data Conections: * P4.6 - CS (active low) * P1.6 - MOSI UCB0SIMO * P1.5 - CLK UCB0CLK * P1.7 - MISO UCB0SOMI FILES: spi.c lcd.c lcd.h main.c main.h pff.c pff.h config.h diskio.c diskio.h integer.h spi.h
  5. Thank you Nurse bob, I' solved this problem, but thanks for your help.
  6. Hello fellows, I need some help, with a situation, I want convert some analog signals to digital and send him by the UART communication, but I dont get how to solve this problem. my digital values is represented by "tempADC" variable, soo how can I get a buffer with values to the pc with UART communication. I try many things, but i dont understand how to put my output signal in the terminal in this format. temperature: 40º temperature: 41º temperature: 42º temperature: 43º can anyone help me?! my code: #include "uart_Tx.h" #include "stdio.h" void UART_TxConfig(void){ /*CLOCK SYSTEM SUPORT (CS)*/ CS->KEY = 0x695A;/*UNLOCK ALL 16 LSB CS REGISTERS*/ CS->CTL0 = 0;/*RESET PARAMETERS*/ CS->CTL0 = CS_CTL0_DCORSEL_5;/**/ /*CLOCK SYSTEM*/ /*SELA_2 ACLK = REFOCLK*/ /*SELS_3 SMCLK = DCOCLK*/ /*SELM_3 MCLK = DCOCLK*/ CS->CTL1 = CS_CTL1_SELA_2 | CS_CTL1_SELS_3 | CS_CTL1_SELM_3; /*LOCK ACESSES TO REGISTERS*/ CS->KEY = 0;/*UNLOCK ALL 16 LSB CS REGISTERS*/ /*UART PIN CONFIGURATION*/ P1-> SEL0 |= BIT2 | BIT3; /*SET 2 UART PIN's*/ /*ACTIVE INTERRUPTION's*/ __enable_interrupt(); /*ACTIVE eUSCIA0 INTERRUPT IN NVIC MODULE*/ NVIC->ISER[0] = 1 << ((EUSCIA0_IRQn) & 31); /*CONFIGURE UART*/ UCA0CTLW0 |= UCSWRST; UCA0CTLW0 |= UCSSEL__SMCLK;/*SELECT SMCLK CLOCK SOURCE*/ /*BAUD RATE CALCULATION * BAUD RATE DIVISOR (TRANSMITIONS RATE) * 12MHz/(16*9600) = 78.125 VELOCITY *FRACTIONAL PORTION = 0.125 *FRACTIONAL */ UCA0BR0 = 26; /*48000000/16/115200*/ UCA0BR1 = 0x00; UCA0MCTLW = 0x1000 | UCOS16 | 0x0020; /*CONTROL WORD REGISTER*/ UCA0CTLW0 &= ~UCSWRST; /*SOFTWARE RESET DISABLE*/ UCA0IE |=UCRXIE; while(1){ } } /*UART INTERRUPT SERVICE ROUTINE*/ void EUSCIA0_IRQHandler (void){ if (UCA0IFG & UCRXIFG){ while(!(UCA0IFG & UCTXIFG)); UCA0TXBUF = UCA0RXBUF; //UCA0TXBUF = adcTemp; //P1->OUT ^= BIT0; } }
  7. Hello I have some problems with a UART comunication to pc, I use CCS to program my code and to debug the results I use Terminal. So my code works fine and do everything well, the biggest problem is the features dont appear well in Terminal window. Can anyone help me?I Send my code and image to apreciate #include "msp.h" int main(void){ UART_TxConfig(); } void UART_TxConfig(void){ /*CLOCK SYSTEM SUPORT (CS)*/ CS->KEY = 0x695A;/*UNLOCK ALL 16 LSB CS REGISTERS*/ CS->CTL0 = 0;/*RESET PARAMETERS*/ CS->CTL0 = CS_CTL0_DCORSEL_5;/**/ /*CLOCK SYSTEM*/ /*SELA_2 ACLK = REFOCLK*/ /*SELS_3 SMCLK = DCOCLK*/ /*SELM_3 MCLK = DCOCLK*/ CS->CTL1 = CS_CTL1_SELA_2 | CS_CTL1_SELS_3 | CS_CTL1_SELM_3; /*LOCK ACESSES TO REGISTERS*/ CS->KEY = 0;/*UNLOCK ALL 16 LSB CS REGISTERS*/ /*UART PIN CONFIGURATION*/ P1-> SEL0 |= BIT2 | BIT3; /*SET 2 UART PIN's*/ /*ACTIVE INTERRUPTION's*/ __enable_interrupt(); /*ACTIVE eUSCIA0 INTERRUPT IN NVIC MODULE*/ NVIC->ISER[0] = 1 << ((EUSCIA0_IRQn) & 31); /*CONFIGURE UART*/ UCA0CTLW0 |= UCSWRST; UCA0CTLW0 |= UCSSEL__SMCLK;/*SELECT SMCLK CLOCK SOURCE*/ /*BAUD RATE CALCULATION * 12MHz/(16*9600) =78.125 *FRACTIONAL PORTION = 0.125 *FRACTIONAL */ UCA0BR0 = 26;/*48000000/16/115200*/ UCA0BR1 = 0x00; UCA0MCTLW = 0x1000 | UCOS16 | 0x0020; /*CONTROL WORD REGISTER*/ UCA0CTLW0 &= ~UCSWRST; /*SOFTWARE RESET DISABLE*/ UCA0IE |=UCRXIE; while(1){ UCA0TXBUF = 'A'; UCA0TXBUF = 'B'; UCA0TXBUF = 'C'; UCA0TXBUF = 'D'; UCA0TXBUF = 0x61; } } /*UART INTERRUPT SERVICE ROUTINE*/ void EUSCIA0_IRQHandler (void){ if (UCA0IFG & UCRXIFG){ while(!(UCA0IFG&UCTXIFG)); } }
  8. Enl, thank you for your answer So I understand your explanation, but how can I proced to read temperature with that sensor. Since I dont obtain a consistent temperature I remove the pin P5.4 from MSP432 and measure the output pin voltage, where I see a float voltage between 1.10 to 1.15 volts. Thank's in advance
  9. No, I don't have another device. But forget the LM35 sensor, you configure the P5.4 to receive a analog signal and convert him, why this pin have oscillation voltage, I have used a multimeter and I measure this pin and I get between 1.10 and 1.15V.
  10. Thank you Nurse Bob, for answer my question, I have 5V power supply to LM35. but my problem has in P5.4 without connect to the output pin of LM35, in the multimeter I measure 1.10 to 1.15V , why? All that calcules are in LM35 data sheet.
  11. Fellows, I'am trying to adquire a signal with ADC converter in the MSP432, but some problems appeard. I try to read lm35 sensor temperature and before conect the lm35 output signal to input pin of MSP432, i made a mesurement with multimeter and i see the pin has 1.10 +/- 1.15v. It's this normal? The code was made in ccs, and with classic programation (registers), this is the code: #include "adc.h" #include "lcd.h" #include "stdio.h" extern char Mensaje[]; /**/ void adc(void){ volatile unsigned int i; /*ADC CONFIGURATION*/ P5->SEL1 |= BIT4; P5->SEL0 |= BIT4; /*ENABLE GLOBAL INTERRUPTS*/ __enable_irq(); /*ENABLE ADC INTERRUPT IN NVIC MODULE*/ NVIC->ISER[0] = 1 << ((ADC14_IRQn) & 31); /*Sampling time, S&H=16, ADC14 on*/ ADC14->CTL0 = ADC14_CTL0_SHT0_2 | ADC14_CTL0_SHP | ADC14_CTL0_ON; ADC14->CTL1 = ADC14_CTL1_RES_2; ADC14->MCTL[0] |= ADC14_MCTLN_INCH_1; ADC14->IER0 |= ADC14_IER0_IE0; SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk; while (1) { for (i = 20000; i > 0; i--); // Start sampling/conversion ADC14->CTL0 |= ADC14_CTL0_ENC | ADC14_CTL0_SC; __sleep(); __no_operation(); } } void ADC14_IRQHandler(void) { int value_adc=ADC14->MEM[0]; float value_vol= value_adc * (3.3/4096); //sprintf(Mensaje,"%d",value_adc); sprintf(Mensaje,"%1.2f",value_vol); LCD_SetText(Mensaje,5 ,0); }
  12. Dear friends, I've already made changes in all files, and I can not get the lcd to work. Attached let the new codes, thank you who can help me! lcd.c lcd.h main.c main.h
  13. Hello fellows, I made a code to interact the MSP430, with the LCD, but now I would like to have it interact with the MSP432. And I'm having some problems because I want to use specific pins, can anyone help me change the code? My difficulty is: the MSP430 I use PORT P1 and P2, the problem is in the MSP432 I need PORT P2, P5 and P6 This is my connections LCD->MSP432: EN -> (P2 + BIT3) RS -> (P6 + BIT7) D4 -> (P2 + BIT6) D5 -> (P2 + BIT4) D6 -> (P5 + BIT6) D7 ->(P6 + BIT6) lcd.c lcd.h main.c main.h
  14. Roadrunner84, I already take the decision and made this code: #include "lcd.h" /*****************************************************************/ /********* DEFINE *********/ /*****************************************************************/ #define P2orP5orP6LCD 0x0200/*PORT[A] OU PORT[B] OU PORT[C]*/ #define EN (PP2 + BIT3) #define RS (PP6 + BIT7) #define D4 (PP2 + BIT6) #define D5 (PP2 + BIT4) #define D6 (PP5 + BIT6) #define D7 (PP6 + BIT6) /*COMMANDS*/ #define CLEAR 0x01 /*****************************************************************/ /********* LOCAL FUNCTIONS *********/ /*****************************************************************/ void lcdDirPinout(unsigned int pin) { if(pin < P2orP5orP6LCD){ P2DIR |= (pin & 0x00FF); }else { P5DIR |= (pin & 0x00FF); } } void lcdClrPinout(unsigned int pin) { if(pin < P2orP5orP6LCD){ P2OUT &= ~(pin & 0x00FF); }else{ P5OUT &= ~(pin & 0x00FF); } } void lcdSetValue(unsigned char value) { if(value & ){ lcdDirPinout(D7); }else{ lcdClrPinout(D7); } if(value & ){ lcdDirPinout(D6); }else{ lcdClrPinout(D6); } if(value & ){ lcdDirPinout(D5); }else{ lcdClrPinout(D5); } if(value & ){ lcdDirPinout(D4); }else{ lcdClrPinout(D4); } delay_us(5); } void lcdTriggerEN() { lcdSetPinout(EN); delay_us(40); lcdClrPinout(EN); } void lcdWriteData(unsigned char data) { lcdSetPinout(RS); lcdSetValue(data >>); /*UPPER NIBBLE*/ lcdTriggerEN(); lcdSetValue(data); /*LOWER NIBBLE*/ lcdTriggerEN(); delay_us(40); } void lcdWriteCmd(unsigned char cmd) { lcdSetPinout(RS); lcdSetValue(cmd >>); /*UPPER NIBBLE*/ lcdTriggerEN(); lcdSetValue(cmd); /*LOWER NIBBLE*/ lcdTriggerEN(); delay_ms(2); } /*****************************************************************/ /********* GLOBAL FUNCTIONS *********/ /*****************************************************************/ void LCD_PortConfig(void) { lcdDirPinout(D7); lcdDirPinout(D6); lcdDirPinout(D5); lcdDirPinout(D4); lcdDirPinout(EN); lcdDirPinout(RS); } void LCD_Initialize(void) { delay_us(80); P6OUT = ; lcdTriggerEN(); delay_ms(2); lcdTriggerEN(); delay_ms(2); lcdTriggerEN(); delay_ms(2); P6OUT = ; /*SWITCH TO 4-BIT MODE*/ lcdTriggerEN(); delay_ms(2); lcdWriteCmd(0x28);/*4 BIT'S MODE, 2 LINES, WITH MATIX 5x8*/ lcdWriteCmd(0x08);/*DISPLAY CURSOR OFF, SHOW OFF WITHOUT CLEAR DDRAM*/ lcdWriteCmd(0x01);/*CLEAR ALL CONTENT SCREEN AN DDRAM*/ lcdWriteCmd(0x06);/*SEND DE PLACE TO PUT CHARACTER HIM*/ lcdWriteCmd(0x0C);/*SHOW CURSOR OFF AND DISPLAY ON, WITHOUT BLINK*/ } void LCD_SetText(char* text, int x, int y) { unsigned int i; if(x < 16){ x|= 0x80; /*WRITE THE FIRST LINE ON LCD*/ switch(y){ case 1: x|= 0x40; /*WRITE THE SECOND LINE ON LCD*/ break; case 2: x|=; /*FIRST LINE WRITE REVERSE*/ break; case 3: x|=; /*SECOND LINE WRITE REVERSE*/ break; } lcdWriteCmd(x); } i=0; while(text[i]!='\0'){ lcdWriteData(text[i]); i++; } } void LCD_SetInt(int val, int x, int y){ char number_string[16]; sprintf(number_string,'%d', val); /*CHARACTER INTEGER TO STRING CONVERTION*/ LCD_SetText(number_string, x, y); } void LCD_Clear() { lcdWriteCmd(CLEAR); } void LCD_SetSymbol(unsigned char symbol, unsigned char offset, unsigned char line) { lcdWriteCmd(line+offset); lcdWriteData(symbol); } /*****************************************************************/ /********* END *********/ /*****************************************************************/ But how can i detect the port? I need to detect the register of the following ports P2 P5 P6
  15. I'm trying to connect the msp432com an lcd. so This way I have to create a routine to read one char variable like0x0A for example and write the data pins for the LCD .(lcd 16x2 4bit interface). Just for testing the port pins registers.