CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Touchpad issues PIC16F1829

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JerryR



Joined: 07 Feb 2008
Posts: 164

View user's profile Send private message

Touchpad issues PIC16F1829
PostPosted: Mon Feb 29, 2016 12:43 pm     Reply with quote

Hello Group:

I am having issues compiling simple touchpad code for a 16F1829 target.

I am using CCS PCWH 5.021 with MPLAB 8.90 IDE.

Compile fails with "Error 99 "Touch_Test.c" Line 9(5,74): Option invalid Bad Pin: 119"

Here's the simple code:
Code:


#include <16f1829.h>
#fuses HS,NOWDT,NOPUT
#use delay(INTERNAL= 8mhz)

#define GREEN_LED   pin_b7
#define GREEN_LED   pin_c4

#use touchpad(scantime=32ms,threshold=7,pin_C3='7',pin_C7='9',pin_b5='1')

void main()
{
INT   i;
TOUCHPAD_STATE(1);

enable_interrupts(GLOBAL);

while (TRUE)
   {
   i=touchpad_getc();

   }   

}


Any suggestions? THANKS!
temtronic



Joined: 01 Jul 2010
Posts: 9188
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 2:17 pm     Reply with quote

though I've never used the touchpad peripheral...


this...
enable_interrupts(GLOBAL);

is NEVER a good thing to do unless you have ISRs coded !!


also having 2 define green_led isn't a good thing either....


EDIT: OK the enable _global is OK...looked it up...
2 defines does error..

for some reason pin C7 and B5 are not valid...delete them and it will compile after define a RED led not 2 green ones.

EDIT: OK B4,B5,C6 and C7 are the 4 'extended' inputs for the 1829 and NONE are liked by the compilers. I'm assuming it might have to do with how the 'touchpad' code was created as the original 8 pins are OK.


Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 2:56 pm     Reply with quote

I did a quick test, and it doesn't like pins B5 or C7. It accepts pins A0-A2,
A4, and C0-C3. These are the same pins that work on the 16F1828.
This looks like the usual CCS deal where they quickly add a new chip to
their database by copying the data from a similar chip. But then it turns
out the new chip has more features, which don't get implemented on the
initial release.

If you have the full IDE of the compiler, it may be possible to edit the
data with the Device Editor. I don't have the full IDE.

In any event, you should contact CCS support and ask them to add the
missing touch pins for the 16F1829.
Ttelmah



Joined: 11 Mar 2010
Posts: 19401

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 3:18 pm     Reply with quote

Yes, it is adjustable in the IDE.
Middle window. Bottom line 'Other features'. Then look down the list for 'Cap Sense Mod'. This then has five selectable lines for the CSM. It's on the penultimate one. Problem though is you cannot tell what the lines actually say - they are too wide for the window, so you can only see the first four pins actually selected. Duh....
The next line starts the same, but what it goes on to say would only be found by trying it.
temtronic



Joined: 01 Jul 2010
Posts: 9188
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 4:19 pm     Reply with quote

It looks like CCS only tests or uses 3 bits for the 'pin selection' even though uC says up to 16 pins 'could' be used.
It's a tad more confusing as a 'USE xxxxxx' feature isn't really a 'nice' driver making it harder to decipher and alter.
I suppose one could cut code with and then without the use touchpad(), dump the listings, compare, disassemble the code..........but..

easier to contact CCS have them do it ! besides it's snowing here and I have to do real work...

been a nice mental challenge though !

Jay
JerryR



Joined: 07 Feb 2008
Posts: 164

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 6:53 am     Reply with quote

Hello group and thanks!

Yes, I was in the middle of cutting and pasting lines when I foud that the code would compile, Sorry for sloppy code. I'm just using it to get my point across about the TouchCap channels.

Yes, I'll contact CCS today and ask them to edit the touch pins. Kinda thought that was the issue.

Thanks again for the sanity-check group!
temtronic



Joined: 01 Jul 2010
Posts: 9188
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 7:33 am     Reply with quote

Had another look at the listing....
The 'touchpad' code is at the top and there's a 'table' of 16 entries which magically have the 'names' of the pins you want to access. It's interesting the table does hold all 16 BUT 0x07 is put into the last 8 ! I presume it's used as a test for 'valid pin'. There's also a lot of lines that clear bit 3, which would limit the range of pins to just the lower 8.
It 'should' be an easy fix for CCS to patch the code.

Jay
JerryR



Joined: 07 Feb 2008
Posts: 164

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 7:35 am     Reply with quote

Thanks temtronic!

Yes, I have already alerted CCS to this issue. Let's see what they come back with. All the best!
Ttelmah



Joined: 11 Mar 2010
Posts: 19401

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 7:54 am     Reply with quote

Changing it in the IDE, does let it accept the extra pins.

If you have the IDE, try it and see if it works.
JerryR



Joined: 07 Feb 2008
Posts: 164

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 7:59 am     Reply with quote

Ttelmah:

I'll give it a try if CCS doesn't respond today. I have schedules to keep.

Thanks!
JerryR



Joined: 07 Feb 2008
Posts: 164

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 11:07 am     Reply with quote

CCS came through and updated the devices file. I can't see a way to attach it here for the group, however.

Working now. Thanks to all.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group