The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.
So far in May, you have voted 0 times ou of a total of 20 votes by the community.
Please help us clean the archives from unuseful discussion threads by using the voting system! Details here.
Is this thread worth a thumbs up?
#define help - Hithesh - Oct 28 7:28:04 2012
How do I #define port1.4 as CS(chip select), so that I can use directly
write CS=0 and CS=1 in the code?
(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: #define help - Joe Radomski - Oct 28 15:54:25 2012
Against my better judgement I'll answer your question.. People really need to
learn to search the archives.. This question comes up fairly often.. The last
time I answered it was back in 2009.. see message # 42196
Â
>________________________________
> From: Hithesh
>To: msp430
>Sent: Sunday, October 28, 2012 7:28 AM
>Subject: [msp430] #define help
>
>
>Â
>
>How do I #define port1.4 as CS(chip select), so that I can use directly
>write CS=0 and CS=1 in the code?
>
>
>
>
>
(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: #define help - Fávero Santos - Oct 29 6:27:24 2012
Hello!
Try something like this:
#define CS_HIGH() P1OUT |= BIT4
#define CS_LOW() P1OUT &= ~BIT4
This way, everytime you call CS_HIGH() and CS_LOW() in your code, it will
run as defined above.
Just to get something clear: When you do
|= you're operating
the port with an OR operation. This means only the bit you've specified
will be changed. The same happens with &= ~ - only in this case
you're unselecting the specified bit.
Good luck!
Fávero Santos
On Sun, Oct 28, 2012 at 9:28 AM, Hithesh wrote:
> **
> How do I #define port1.4 as CS(chip select), so that I can use directly
> write CS=0 and CS=1 in the code?
>
>
>
>
>

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: #define help - Hithesh - Oct 29 13:41:24 2012
Fávero
Woooohoooo!
Thanks. That works great.
-Hithesh
On Mon, Oct 29, 2012 at 3:57 PM, Fávero Santos
wrote:
> Hello!
>
> Try something like this:
>
> #define CS_HIGH() P1OUT |= BIT4
> #define CS_LOW() P1OUT &= ~BIT4
>
> This way, everytime you call CS_HIGH() and CS_LOW() in your code, it will
> run as defined above.
>
> Just to get something clear: When you do |= you're
operating
> the port with an OR operation. This means only the
bit you've specified
> will be changed. The same happens with &= ~ - only in this
case
> you're unselecting the specified bit.
>
> Good luck!
>
> Fávero Santos
>
> On Sun, Oct 28, 2012 at 9:28 AM, Hithesh wrote:
>
> > **
> >
> >
> > How do I #define port1.4 as CS(chip select), so that I can use directly
> > write CS=0 and CS=1 in the code?
> >
> >
> >
> >
> >
>
>
>

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )