[Dspforum] --consultant issue and C question

O'Connor, Sean R. Sean.OConnor at jhuapl.edu
Tue Oct 6 10:00:05 MDT 2009


Thanks, Alan.  I did have the parentheses in the #define, but forgot to put them in the email.  The error the compiler threw was pointed to the program line containing the bitwise logic.  I will try your 'volatile Uint8 * cpld_user...' variable definition tonight.

-Sean

________________________________
From: dspforum-bounces at echelonembedded.com [mailto:dspforum-bounces at echelonembedded.com] On Behalf Of Alan Ding
Sent: Tuesday, October 06, 2009 11:20 AM
To: dspforum at echelonembedded.com
Subject: Re: [Dspforum] --consultant issue and C question

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<mailto: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<mailto: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<mailto:alan33d at gmail.com>
Contact #: 4844593290
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://echelonembedded.com/pipermail/dspforum_echelonembedded.com/attachments/20091006/b3e06a97/attachment.html>


More information about the Dspforum mailing list