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 CCS Technical Support

Search found 40 matches
CCS Forum Index
Author Message
  Topic: Disabling interrupts when writing to data EEPROM
lindsay.wilson.88

Replies: 2
Views: 2969

PostForum: General CCS C Discussion   Posted: Sun Oct 20, 2024 5:11 am   Subject: Disabling interrupts when writing to data EEPROM
Just spent the morning tearing my hair out wonder why my nice regular timer1 interrupts were screwing up whenever I wrote anything to the data EEPROM and, sure enough, I should have read the datasheet ...
  Topic: Ternary/conditional operator - trouble with strings
lindsay.wilson.88

Replies: 7
Views: 5235

PostForum: General CCS C Discussion   Posted: Mon Oct 14, 2024 7:49 am   Subject: Ternary/conditional operator - trouble with strings
No problem. I had found a few examples online which should have done the trick, but they again were in normal C.
  Topic: Ternary/conditional operator - trouble with strings
lindsay.wilson.88

Replies: 7
Views: 5235

PostForum: General CCS C Discussion   Posted: Sun Oct 13, 2024 11:01 am   Subject: Ternary/conditional operator - trouble with strings
@Ttelmah Thanks for the suggestion - I've just had a try with using strcpy, and with #device PASS_STRINGS=IN_RAM, but unfortunately it's outputting gibberish. Strcpy works fine with just a single lite ...
  Topic: Ternary/conditional operator - trouble with strings
lindsay.wilson.88

Replies: 7
Views: 5235

PostForum: General CCS C Discussion   Posted: Sat Oct 12, 2024 12:16 pm   Subject: Ternary/conditional operator - trouble with strings
Thanks - yeah, looking around, I think I get a feeling for why it's not possible. Never was entirely happy with pointers!

I've stuck to putting separate printf() in each possible option:

printf& ...
  Topic: Ternary/conditional operator - trouble with strings
lindsay.wilson.88

Replies: 7
Views: 5235

PostForum: General CCS C Discussion   Posted: Fri Oct 11, 2024 7:54 pm   Subject: Ternary/conditional operator - trouble with strings
I'm trying to use the ?: operator to choose a string based on a variable's value and I'm having trouble getting it to return strings. As a basic example, try this:

int1 clsmode=1; // Clear screen m ...
  Topic: Confused about atol() and unsigned values
lindsay.wilson.88

Replies: 7
Views: 5296

PostForum: General CCS C Discussion   Posted: Fri Oct 11, 2024 10:11 am   Subject: Confused about atol() and unsigned values
Ahhh makes sense. (unsigned int16) does the trick.

I'm definitely using the most recent version (5.118) and there's no sign of atol32 in stdlib.h, only atoi32. I guess it's maybe redundant since at ...
  Topic: Confused about atol() and unsigned values
lindsay.wilson.88

Replies: 7
Views: 5296

PostForum: General CCS C Discussion   Posted: Fri Oct 11, 2024 5:16 am   Subject: Confused about atol() and unsigned values
Couple more things ;-)

Am I correct in thinking that if v is declared as an unsigned int16, then it'll definitely hold the correct value (as in, 0 to 65535) when I do v=atol(uart_text)? Looking at ...
  Topic: Confused about atol() and unsigned values
lindsay.wilson.88

Replies: 7
Views: 5296

PostForum: General CCS C Discussion   Posted: Thu Oct 10, 2024 7:25 pm   Subject: Confused about atol() and unsigned values
My brain hurts ;-) I think I get what you're describing!

Turns out Windows calculator does signed integers (2's complement). If I stick in 10000 then multiply by 5, it says -15536, so that overflow ...
  Topic: Thoughts on terminal emulator for serial interface
lindsay.wilson.88

Replies: 8
Views: 30960

PostForum: General CCS C Discussion   Posted: Thu Oct 10, 2024 6:54 pm   Subject: Thoughts on terminal emulator for serial interface
Thanks for the tips everyone, some good pointers there.
  Topic: Confused about atol() and unsigned values
lindsay.wilson.88

Replies: 7
Views: 5296

PostForum: General CCS C Discussion   Posted: Wed Oct 09, 2024 7:19 pm   Subject: Confused about atol() and unsigned values
Suppose I have the following:

unsigned int16 v;
get_string(uart_text,10);
v=atol(uart_text);
printf("You entered: %lu\r\n",v);

This compiles and runs fin ...
  Topic: Thoughts on terminal emulator for serial interface
lindsay.wilson.88

Replies: 8
Views: 30960

PostForum: General CCS C Discussion   Posted: Sat Oct 05, 2024 7:32 pm   Subject: Thoughts on terminal emulator for serial interface
Not strictly PIC or CCS related, but I'm curious about what people think is the best way to interact with a simple menu system over a serial connection. More over-thinking as usual on my part ;-)

A ...
  Topic: Best way to update Timer 2 to avoid unwelcome glitches
lindsay.wilson.88

Replies: 8
Views: 5526

PostForum: General CCS C Discussion   Posted: Tue Oct 01, 2024 8:46 am   Subject: Best way to update Timer 2 to avoid unwelcome glitches
I'm beginning to realise that like with most things I'm a bit behind the curve! There's probably lots of amazing things that the 24's could do which I'm missing out on. I've never been that hot on pro ...
  Topic: Preventing buffer overflow when using gets()
lindsay.wilson.88

Replies: 14
Views: 7897

PostForum: General CCS C Discussion   Posted: Tue Oct 01, 2024 7:26 am   Subject: Preventing buffer overflow when using gets()
Mmmm....sounds like I'd better just stick with the one interrupt.

Re: those text files, AWESOME! I never would have figured out to look there - I have to say, much as I like the compiler compared w ...
  Topic: Best way to update Timer 2 to avoid unwelcome glitches
lindsay.wilson.88

Replies: 8
Views: 5526

PostForum: General CCS C Discussion   Posted: Tue Oct 01, 2024 7:22 am   Subject: Best way to update Timer 2 to avoid unwelcome glitches
@Ttelmah Mainly laziness and inertia - I've mostly just used timer 1 or 2 in the past for things like this and never even looked at the CCP module 🤣🤣 I went and had a play with it, and things ar ...
  Topic: Preventing buffer overflow when using gets()
lindsay.wilson.88

Replies: 14
Views: 7897

PostForum: General CCS C Discussion   Posted: Mon Sep 30, 2024 9:38 am   Subject: Preventing buffer overflow when using gets()
@jeremiah - that makes total sense now, thanks!

@ttelmah - I just had a closer look at what get_string is doing and you're right, it reads and gets rid of everything after the max characters ;-) Th ...
 
Page 1 of 3 Goto page 1, 2, 3  Next
All times are GMT - 6 Hours
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group