Difference between revisions of "Playing With PIC Pack"

From OpenCircuits
Jump to navigation Jump to search
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Starting Off ==
 
== Starting Off ==
 +
Pic Pack is an interesting library of PIC C code for BoostC and has an accompanying set of tutorials.  I can be found using the links below.  I have wanted to try it out for a while, here is my experience ( so far )
 +
 
Author [[russ_hensel]]
 
Author [[russ_hensel]]
  
I recording some experiences playing with pic pack.
+
I am recording some experiences playing with pic pack.
 +
 
 +
Page Not currently linked into Open Circuits will do so later, when more complete.
  
Not linked into Open Circuits may do so later.
+
I could not find beginning of blog, best I got was part 13, googling let me find welcome finally got the archive for 08 to open.  This guide will have links in order for each section.
  
could not find beginning of blog, best I got was part 13, googling let me find welcome finally got the archive for 08 to open,
+
I am using BoostC 6.90 unlimited non-commercial on a pretty much up to date XP system
  
I am using BoostC 6.90 unlimmited non-commercial on a pretty much up to date XP system
 
  
 
== First 4 parts ==
 
== First 4 parts ==
  
[http://embeddedadventures.blogspot.com/2008/04/1introduction.html part1]
+
[http://embeddedadventures.blogspot.com/2008/04/1introduction.html 07 April 2008 -- 1. Introduction]
 +
 
 +
[http://embeddedadventures.blogspot.com/2008/04/2-microcontrollers.html 07 April 2008 -- 2. Microcontrollers]
 +
 
 +
[http://embeddedadventures.blogspot.com/2008/04/3-take-your-pic.html 07 April 2008 -- 3. Take your pic]
 +
 
 +
[http://embeddedadventures.blogspot.com/2008/04/4compilers.html 07 April 2008 -- 4. Compilers]
 +
 
 +
Make sense to me, just read them.
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/04/5-your-first-pic-program.html Part 5. Your first pic program -- 07 April 2008] ==
 +
 
 +
Notes from:  Jan 11 2009
 +
 
 +
* text said: adventures\flasher:  try instead: demos\flasher  think this it was moved.
 +
 
 +
* no mention of target, i left it at:  16f88  ( target is part of the project, so of course it was right for the text.
 +
 
 +
* I tried to build, IDE said building... but then nothing?  I am using 6.90
 +
 
 +
tried compile and got error locating the compiler, so I pointed the IDE to mine. Problem was I do not keep my compiler in the normal location, all users shuld check this setting if the build just seems to hang.
 +
 
 +
* Then had error finding:  C:\Source\Electronics\MicroController\Pic\PicPack\demoCopy\flasher\flasher.c(7): Unable to open include file: pic_utils.h
 +
 
 +
This is because I had moved the project, need to keep the relative locations of... demos and ...pic_pack_lib unchanged so I put a copy in the right relative location.
 +
 
 +
* Now compiles successfully.
 +
 
 +
but got the warning
 +
 
 +
#ifndef GOT_CLOCK
 +
#warning "Don't know about your clock. See pic_utils.h"
 +
#endif
 +
 
 +
This seems to be related to lack of definition of PLATFORM_CLOCK == 12000000. Perhaps this is what should be in flasher.c instead of ( or in addition to ) #pragma CLOCK_FREQ 8000000 Or perhaps it is just a warning to be ignored.
 +
 
 +
* note that
 +
    /*
 +
 
 +
    */
 +
 
 +
in the code denotes a comment ( and that the contents is ignored by the compiler).
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/04/6-chip-programming.html 08 April 2008 -- 6. Chip Programming] ==
 +
 
 +
 
 +
*I am going to try an 18f2550 so looking up the configurations setting for it.
 +
 
 +
I am confused about config1, 2.... and the high and low so how do I read the .h file? Seems that for the 18F2550 we need
 +
 
 +
_CONFIG1L,  _CONFIG1H,  _CONFIG2L,  ....
 +
 
 +
this seems at least to compile .... but the linker fails with
 +
 
 +
Error: .obj or .lib file wrong target type
 +
Error: Failed to process:pic_utils.obj
 +
 
 +
Perhaps i am still missing some sort of config or #define switch.  But no problem fixed by removing all but ._c .c and .h files and recompiling, changing target from 16F to 18F was probably the problem.
 +
 
 +
Putting in the configuration took me a long time, 16 config locations.  Not sure I have them right, perhaps if I copied a configuration from some bootloader that worked on my chip?
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/04/7-bootloading.html 7. Bootloading -- 08 April 2008] ==
 +
 
 +
 
 +
* I do not want to use 16f88, I do not have one, I will use either the 18f2550 or if I have to the 16F877 which I have a lot of, and have used a lot.
 +
 
 +
It is late, good night for now....
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/04/serial-ports.html Part 8. Serial ports -- 12 April 2008] ==
 +
 
 +
Ok, reads fine.
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/04/8-its-about-time.html Part 9. It's about time -- 14 April 2008] ==
 +
 
 +
Just reading:
 +
 
 +
''There’s the serial handlers, as usual, but also the timer_handle_0_isr() routine – which takes care of timer 0. Note that in your code somewhere, you need to include a routine called timer_0_callback() like this:''
 +
 
 +
Why do I need the timer_0_callback() is it because the call is imbedded in timer_handle_0_isr() -- and if so how did you compile without it?
 +
 
 +
 
 +
test_tick = tick_get_count(); // find out what we're up to
 +
if (tick_calc_diff(tick_marker, test_tick) >= 1000) { // 1000 - it's a second
 +
      serial_print_str(" "); // print something out
 +
      tick_marker = test_tick; // reset to find next 1000
 +
  }
 +
 
 +
fix formatting
 +
 
 +
find out what we're up to is this a pun meaning find out what count the pic_tick is up to ( on timer0 ) ?
 +
 
 +
is the intent of this to ignore the time it takes to print? will this do it every second or pause 1 second between prints?
 +
 
 +
what is the data type of test_tick, I guess I could look at the header file. or am i susposed to be editiong a sample  Why does it work even if it wraps around?
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/04/10-on-display.html Part 10. On Display -- 16 April 2008] ==
 +
 
 +
 
 +
read it seems fine.
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/04/11-its-hot-in-here.html Part 11. It's hot in here -- 19 April 2008] ==
 +
 
 +
 
 +
covers i2c protocol itself  -- interesting but do not have this device
  
[http://embeddedadventures.blogspot.com/2008/04/2-microcontrollers.html part2]
 
  
[http://embeddedadventures.blogspot.com/2008/04/3-take-your-pic.html part3]
+
rest read ok,  -- did not open sample code, need to go back and do this.
  
[http://embeddedadventures.blogspot.com/2008/04/4compilers.html part4]
+
== [http://embeddedadventures.blogspot.com/2008/04/which-pic.html 19 April 2008 -- 12. Which Pic?] ==
  
Just read them.
 
  
== 5. Your first pic program ==
+
read just a discussion of various pics, which left out the 16f877a one of my favoriates.
  
[http://embeddedadventures.blogspot.com/2008/04/5-your-first-pic-program.html part5]
+
== [http://embeddedadventures.blogspot.com/2008/04/its-about-time.html  22 April 2008 -- 13. It's about time] ==
  
Jan 11 2009:
 
  
said: adventures\flash  try instead: demos\flasher  think this is were it is now
+
== [http://embeddedadventures.blogspot.com/2008/04/picpack-11-released.html 28 April 2008 -- PicPack 1.1 released] ==
  
no mention of target, i left it at:  16f88
 
  
said building... but then nothing?  I am using 6.90
+
== [http://embeddedadventures.blogspot.com/2008/04/13-of-ports-and-pins-and-sfrs.html 29 April 2008 -- 14. Of Ports and Pins and SFRs] ==
  
tried compile and got error locating the compiler, so I pointed to mine, problem was I did not keep mine in the normal location, all users shuld check this setting
 
  
Then had error finding C:\Source\Electronics\MicroController\Pic\PicPack\demoCopy\flasher\flasher.c(7): Unable to open include file: pic_utils.h
+
== [http://embeddedadventures.blogspot.com/2008/05/14-all-meshed-up-part-1-rf-comms.html 06 May 2008 -- 15. All meshed up - Part 1 - RF comms] ==
  
this is because I had moved the project, need to keep the relative locations of... demos and pic_pack_lib unchanged
 
  
 +
== [http://embeddedadventures.blogspot.com/2008/05/15-all-meshed-up-part-2-packet-network.html 13 May 2008 -- 16. All meshed up - Part 2 - Packet network basics] ==
  
Now compiles successfully.
 
  
but warning
 
  
#ifndef GOT_CLOCK
 
#warning "Don't know about your clock. See pic_utils.h"
 
#endif
 
  
 +
== [http://embeddedadventures.blogspot.com/2008/05/all-meshed-up-part-3-packet-chatting.html 16 May 2008 -- 17. All meshed up – Part 3 – Packet chatting] ==
  
seems to be related to lack of definition of PLATFORM_CLOCK == 12000000 perhaps this is what should be in flasher.c instead of #pragma CLOCK_FREQ 8000000
 
  
or perhaps it is just a warning to be ignored.
+
== [http://embeddedadventures.blogspot.com/2008/05/picpack-12-released.html 16 May 2008 -- PicPack 1.2 released] ==
  
note that /*
 
  
*/ denotes a comment that is ignored by the compiler.
+
== [http://embeddedadventures.blogspot.com/2008/05/17-all-meshed-up-part-4-working-in-code.html 19 May 2008 -- 18. All meshed up – Part 4 – Working in code] ==
  
== 6. Chip Programming ==
 
  
[http://embeddedadventures.blogspot.com/2008/04/6-chip-programming.html 6. Chip Programming]
+
== [http://embeddedadventures.blogspot.com/2008/06/new-toys-maplin-mobile-power-pack.html 15 June 2008 -- New toys - Maplin Mobile Power Pack] ==
  
I am going to try an 18f2550 so looking up the config for it
 
  
  
I am confused about config1, 2.... and the high and low so how do I read the .h file?
+
== [http://embeddedadventures.blogspot.com/2008/07/new-picpack-with-usb-support-rc1.html 22 July 2008 -- New PicPack - with USB support - RC1] ==
  
seems that for the 18F2550 we need
 
  
_CONFIG1L,  _CONFIG1H,  _CONFIG2L,  ....  
+
== [http://embeddedadventures.blogspot.com/2008/07/usb-part-1-introduction.html 28 July 2008 -- USB part 1 - Introduction] ==
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/08/usb-part-2-joy-mouse-in-this-example-im.html 05 August 2008 -- USB Part 2 - The Joy Mouse] ==
 +
 
 +
 
 +
== [http://embeddedadventures.blogspot.com/2008/12/see-saw-photo.html
 +
12 December 2008
 +
See Saw Photo
  
this seems at least to compile
 
  
== 7. Bootloading ==
+
== [http://embeddedadventures.blogspot.com/2009/01/usb-part-3-configuring-picpack-usb.html
 +
09 January 2009
 +
USB Part 3 – Configuring the PicPack USB library
  
[http://embeddedadventures.blogspot.com/2008/04/7-bootloading.html 7. Bootloading]
 
  
 +
== [http://embeddedadventures.blogspot.com/2009/01/usb-part-4-inner-workings-of-picpack.html
 +
12 January 2009
 +
USB part 4 – Inner workings of the PicPack USB stack
  
do not want to use 16f88, do not have one, will use either the 18f2550 or if I have to the 16F877 which I have a lot of and have used a lot.
+
== [http://embeddedadventures.blogspot.com/2009/01/usb-part-5-using-usb-serial-library.html
 +
26 January 2009
 +
USB Part 5 – Using the USB Serial library
  
== 8 ==
 
  
[ part1x]
+
== [http://embeddedadventures.blogspot.com/2009/01/picpack-20-released.html
 +
26 January 2009
 +
PicPack 2.0 released
  
== 9 ==
 
  
[ part1x]
 
  
[ part1x]
+
[[category:Microcontroller]][[category:PIC]][[category:BoostC]]

Latest revision as of 11:41, 26 April 2010

Starting Off[edit]

Pic Pack is an interesting library of PIC C code for BoostC and has an accompanying set of tutorials. I can be found using the links below. I have wanted to try it out for a while, here is my experience ( so far )

Author russ_hensel

I am recording some experiences playing with pic pack.

Page Not currently linked into Open Circuits will do so later, when more complete.

I could not find beginning of blog, best I got was part 13, googling let me find welcome finally got the archive for 08 to open. This guide will have links in order for each section.

I am using BoostC 6.90 unlimited non-commercial on a pretty much up to date XP system


First 4 parts[edit]

07 April 2008 -- 1. Introduction

07 April 2008 -- 2. Microcontrollers

07 April 2008 -- 3. Take your pic

07 April 2008 -- 4. Compilers

Make sense to me, just read them.

Part 5. Your first pic program -- 07 April 2008[edit]

Notes from: Jan 11 2009

  • text said: adventures\flasher: try instead: demos\flasher think this it was moved.
  • no mention of target, i left it at: 16f88 ( target is part of the project, so of course it was right for the text.
  • I tried to build, IDE said building... but then nothing? I am using 6.90

tried compile and got error locating the compiler, so I pointed the IDE to mine. Problem was I do not keep my compiler in the normal location, all users shuld check this setting if the build just seems to hang.

  • Then had error finding: C:\Source\Electronics\MicroController\Pic\PicPack\demoCopy\flasher\flasher.c(7): Unable to open include file: pic_utils.h

This is because I had moved the project, need to keep the relative locations of... demos and ...pic_pack_lib unchanged so I put a copy in the right relative location.

  • Now compiles successfully.

but got the warning

#ifndef GOT_CLOCK
	#warning "Don't know about your clock. See pic_utils.h"
#endif	

This seems to be related to lack of definition of PLATFORM_CLOCK == 12000000. Perhaps this is what should be in flasher.c instead of ( or in addition to ) #pragma CLOCK_FREQ 8000000 Or perhaps it is just a warning to be ignored.

  • note that
   /*
  
   */ 

in the code denotes a comment ( and that the contents is ignored by the compiler).

08 April 2008 -- 6. Chip Programming[edit]

  • I am going to try an 18f2550 so looking up the configurations setting for it.

I am confused about config1, 2.... and the high and low so how do I read the .h file? Seems that for the 18F2550 we need

_CONFIG1L,  _CONFIG1H,   _CONFIG2L,   .... 

this seems at least to compile .... but the linker fails with

Error: .obj or .lib file wrong target type
Error: Failed to process:pic_utils.obj

Perhaps i am still missing some sort of config or #define switch. But no problem fixed by removing all but ._c .c and .h files and recompiling, changing target from 16F to 18F was probably the problem.

Putting in the configuration took me a long time, 16 config locations. Not sure I have them right, perhaps if I copied a configuration from some bootloader that worked on my chip?

7. Bootloading -- 08 April 2008[edit]

  • I do not want to use 16f88, I do not have one, I will use either the 18f2550 or if I have to the 16F877 which I have a lot of, and have used a lot.

It is late, good night for now....

Part 8. Serial ports -- 12 April 2008[edit]

Ok, reads fine.

Part 9. It's about time -- 14 April 2008[edit]

Just reading:

There’s the serial handlers, as usual, but also the timer_handle_0_isr() routine – which takes care of timer 0. Note that in your code somewhere, you need to include a routine called timer_0_callback() like this:

Why do I need the timer_0_callback() is it because the call is imbedded in timer_handle_0_isr() -- and if so how did you compile without it?


test_tick = tick_get_count(); // find out what we're up to
if (tick_calc_diff(tick_marker, test_tick) >= 1000) { // 1000 - it's a second
      serial_print_str(" "); // print something out
      tick_marker = test_tick; // reset to find next 1000
 }

fix formatting

find out what we're up to is this a pun meaning find out what count the pic_tick is up to ( on timer0 ) ?

is the intent of this to ignore the time it takes to print? will this do it every second or pause 1 second between prints?

what is the data type of test_tick, I guess I could look at the header file. or am i susposed to be editiong a sample Why does it work even if it wraps around?

Part 10. On Display -- 16 April 2008[edit]

read it seems fine.

Part 11. It's hot in here -- 19 April 2008[edit]

covers i2c protocol itself   -- interesting but do not have this device 


rest read ok, -- did not open sample code, need to go back and do this.

19 April 2008 -- 12. Which Pic?[edit]

read just a discussion of various pics, which left out the 16f877a one of my favoriates.

22 April 2008 -- 13. It's about time[edit]

28 April 2008 -- PicPack 1.1 released[edit]

29 April 2008 -- 14. Of Ports and Pins and SFRs[edit]

06 May 2008 -- 15. All meshed up - Part 1 - RF comms[edit]

13 May 2008 -- 16. All meshed up - Part 2 - Packet network basics[edit]

16 May 2008 -- 17. All meshed up – Part 3 – Packet chatting[edit]

16 May 2008 -- PicPack 1.2 released[edit]

19 May 2008 -- 18. All meshed up – Part 4 – Working in code[edit]

15 June 2008 -- New toys - Maplin Mobile Power Pack[edit]

22 July 2008 -- New PicPack - with USB support - RC1[edit]

28 July 2008 -- USB part 1 - Introduction[edit]

05 August 2008 -- USB Part 2 - The Joy Mouse[edit]

== [http://embeddedadventures.blogspot.com/2008/12/see-saw-photo.html 12 December 2008 See Saw Photo


== [http://embeddedadventures.blogspot.com/2009/01/usb-part-3-configuring-picpack-usb.html 09 January 2009 USB Part 3 – Configuring the PicPack USB library


== [http://embeddedadventures.blogspot.com/2009/01/usb-part-4-inner-workings-of-picpack.html 12 January 2009 USB part 4 – Inner workings of the PicPack USB stack

== [http://embeddedadventures.blogspot.com/2009/01/usb-part-5-using-usb-serial-library.html 26 January 2009 USB Part 5 – Using the USB Serial library


== [http://embeddedadventures.blogspot.com/2009/01/picpack-20-released.html 26 January 2009 PicPack 2.0 released