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

ccs c book

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



Joined: 14 Dec 2022
Posts: 39

View user's profile Send private message

ccs c book
PostPosted: Wed Jan 04, 2023 2:21 pm     Reply with quote

sifirzero1



Joined: 14 Dec 2022
Posts: 39

View user's profile Send private message

PostPosted: Wed Jan 04, 2023 2:22 pm     Reply with quote

Who has the book on this site? Would you sell or gift the book? thanks

http://janniehamman.co.za/
temtronic



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

View user's profile Send private message

PostPosted: Sat Jan 07, 2023 9:35 am     Reply with quote

One of the best ways to learn CCS C , is to look at the 100s of example programs that CCS supplies in the 'examples' folder !
You can also see working programs in the 'code library' on this forum.

I went to the website for that book, but didn't see any examples of his code
sifirzero1



Joined: 14 Dec 2022
Posts: 39

View user's profile Send private message

PostPosted: Sat Jan 07, 2023 9:42 am     Reply with quote

because the book is on sale. didn't share much
temtronic



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

View user's profile Send private message

PostPosted: Sat Jan 07, 2023 10:26 am     Reply with quote

Most writers will show a sample of what's inside the book.
I will NOT buy that book without seeing something.

Would you buy a car without actually seeing it ?
sifirzero1



Joined: 14 Dec 2022
Posts: 39

View user's profile Send private message

PostPosted: Sat Jan 07, 2023 10:32 am     Reply with quote

website has samples at the bottom of the page and images from the book
temtronic



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

View user's profile Send private message

PostPosted: Sat Jan 07, 2023 10:47 am     Reply with quote

hmm, I didn't scroll down to the end...just to the 'buy it now' info...
I did download the 7segment code.
It has an error in the first few lines..

hint the PIC doesn't have a 16 bit ADC...
sifirzero1



Joined: 14 Dec 2022
Posts: 39

View user's profile Send private message

PostPosted: Sat Jan 07, 2023 11:25 pm     Reply with quote

shall I not buy the book? is it naughty
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 08, 2023 1:50 pm     Reply with quote

I say don't buy. His Accelerometer program has bugs.
http://janniehamman.co.za/progs/accel355.c

In his main loop, he is not doing the acquisition delay after changing the
adc channels:
Code:
void main()
{
   setup_adc_ports(sAN0|sAN1|sAN2);
   setup_adc(ADC_CLOCK_INTERNAL);

   while(TRUE)
   {

      set_adc_channel(0);
      rax=read_adc();
      ax=calcxy(rax);   
     
      set_adc_channel(1);
      ray=read_adc();
      ay=calcxy(ray);
     
      set_adc_channel(2);
      raz=read_adc();
      az=calcz(raz);
     

The acquisition time is given in this section of the 16F88 data sheet:
12.1 A/D Acquisition Requirements (page 119)
It is listed in the equations as 19.72 us. His code should look like this:
Quote:

set_adc_channel(0);
delay_us(20);
rax=read_adc();
ax=calcxy(rax);

set_adc_channel(1);
delay_us(20);
ray=read_adc();
ay=calcxy(ray);

set_adc_channel(2);
delay_us(20);
raz=read_adc();
az=calcz(raz);


Also, his ADC setup is this:
Code:
setup_adc(ADC_CLOCK_INTERNAL);

But the 16F88 data sheet says on page 120:
Quote:
2: When the device frequencies are greater than 1 MHz, the RC A/D
conversion clock source is only recommended for Sleep operation.

He is running at 8MHz, therefore his setup should be:
Code:
setup_adc(ADC_CLOCK_DIV_16)

The DIV_16 value comes from this table in the PIC data sheet:
TABLE 12-1: TAD vs. MAXIMUM DEVICE OPERATING FREQUENCIES
on page 120. 16F88 data sheet:
https://ww1.microchip.com/downloads/en/devicedoc/30487c.pdf
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