sir
In my design i am arriving a hex value (ex.324) in the address (0X020C)
i want to send this hex value to a port pin
idono how to do this
pls help me to do this or pls refer me some sample code of this type
thanks in advance
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
sir
In my design i am arriving a hex value (ex.324) in the address (0X020C)
i want to send this hex value to a port pin
idono how to do this
pls help me to do this or pls refer me some sample code of this type
thanks in advance
Hi,
Can you explain a little bit more?
I could not understanding your question.
You set up the USCI A0 (or USCI B0) for the type of port you want, uart or SPI etc.
You then copy the value from the address (0x020C) to UCA0TXBUF and away it goes.
/***************************************************************************************************************************************************************** * ******************************************************************************************************************************************************************/ void Transmite_byte_serial(unsigned char byte_x) { while (!(UCA0IFG & UCTXIFG)); // USCI_A0 TX buffer ready? UCA0TXBUF = byte_x; // TX -> RXed character }
sir i have to send this hex value from address(ex.0X02C0)to another controller
i m totally new to this and i dono how???
pls guide me
sir this my code @P1.2 i will receive hex value of 300 this i have send to another controller
#include <msp430G2553.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BCSCTL1 = CALBC1_1MHZ; // Set range
DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation */
P1OUT = 0x00;
P1DIR |= 0x24; // P1.2 and P1.5 output
P1SEL |= 0x04; // P1.2 TA1/2 options
P1OUT|=0x20;
CCR0 = 300; // PWM Period
CCTL1 = OUTMOD_7; // CCR1 reset/set
CCR1=20;
TACTL = TASSEL_2 + MC_1; // SMCLK, up mode
_BIS_SR(CPUOFF); // Enter LPM0
}
pls help me to this
thanks
Hi,
In that case, i think you are genating a pwm and wants to read the dutycicle on the other side right?
So the other side timer hast to be configured as an input capture timer so you will be able to measure the on time of the pwm.
first i think you should install the MSPware and play a little bit with the examples, there are quite a few there. just to get a little bit more knowledge of the micro.
than you will be able to accomplish more advanced tasks.
It’s still not really clear what you mean with ‘send it to’. A pin is a pin. It can only have the value ‘0’ or ‘1’. To send anything else but ‘0’ or’1’ on a signal pin, it either needs to be an analog pin (then you could output an analog value that corresponds to, say, 0 to 2.5V for values from 0 to 0xFFF), or the value needs to be sent with some timing. One example is the UART, where (given a predefined baudrate) the bits of the value are send one by one.
Another one would be PWM. Here the value is sent as the time (percentage) a signal of a given frequency is either high or low. This can be done with a timer. However, decoding it is difficult. (a possible way is to send it though a low-pass filter. Then the resulting filter output voltage will be once more an analog value. This way is usually used to control motor speeds (as their physical construction acts as low-pass filter).
However, I used it once to output a 16 bit value by the duration for the high and low pulses. It was measured by an external timer/counter device and acted as debug output until I got the UART code running for the 5x family.
Perhaps it would help if you tell what purpose the value shall serve after you sent it out this way or another.
BTW: where do you get this ‘value’ from? Address 0x20c is RAM, so it doesn’t ‘appear’ there out of thin air.
How many bits are there in "a hex value of 324"?
I think there are at least 18 bits. But could be more with leading 0's.
old_cow_yellow said:How many bits are there in "a hex value of 324"?
I think there are at least 18 bits. But could be more with leading 0's.
**Attention** This is a public forum