[Dspforum] --consultant issue and C question
Alan Ding
alan33d at gmail.com
Tue Oct 6 09:19:43 MDT 2009
For using the DIP switch, i did this:
if (((*cpld_user & 0xff) & (0x10 << 2)) == 0) //SW2 is depressed
where 2 is for the second dip switch and cpld_user is defined as:
volatile Uint8 *cpld_user = (Uint8 *)(0x90080000); //cpld user register
bits for dip switches and LEDs
Your approach looks other than maybe you were missing a parentheses:
#define SWITCHES *(unsigned volatile char *)(0x90080000);
to
#define SWITCHES *((unsigned volatile char *)(0x90080000));
I don't have a compiler right now to verify this but at least my approach
should work.
~Alan
On Tue, Oct 6, 2009 at 10:30 AM, O'Connor, Sean R.
<Sean.OConnor at jhuapl.edu>wrote:
> I tried to use the --consultant last night and couldn't figure out how to
> read the output of the consultant. Does it generate a file or will an
> automated window pop up? Nothing seemed to happen when I turned on the
> --consultant flag in "Build Options". The instructions from the built in
> help menu is CCS, told me to enable Profiling and look for the consultant
> tab (which I couldn't find).
>
> Also, I wanted to use the CLPD User Register to access the DIP switches (in
> place of the built in DSK functions) using, for example, '#define SWITCHES
> *(unsigned volatile char *)(0x90080000); and then 'anding' the result with
> a mask, ie 'sw2 = SWITCHES & 0x20;' to uncover DIP switch #2's value. I've
> used this approach on 8-bit micros, but the CCS compiler didn't like it. Is
> there another (or a better) way to do this?
>
> Thanks!
> -Sean
>
> _______________________________________________
> Dspforum mailing list
> Dspforum at echelonembedded.com
> http://echelonembedded.com/mailman/listinfo/dspforum_echelonembedded.com
>
>
--
-------------------------------------------------------
Alan Ding
Master of Sci, Electrical Engineering
Johns Hopkins University
Email: alan33d at gmail.com
Contact #: 4844593290
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://echelonembedded.com/pipermail/dspforum_echelonembedded.com/attachments/20091006/9c190e51/attachment.html>
More information about the Dspforum
mailing list