Jump to content

Picxie

Moderator
  • Content Count

    277
  • Joined

  • Last visited

Everything posted by Picxie

  1. The diodes are part of the ESD protection. I think generally they are not drawn on the block diagram, their presence is assumed. Have a look at other datasheets. I think they have been drawn on the portA diagrams of the 16f88 to illustrate that RA5 does not have a diode to supply (you wouldnt be able to set Vpp if a diode was present) The best thing you can do is to ask Microchip at http://support.microchip.com/scripts/slxwe...e=webticketcust They are fairly fast at responding and should give an accurate answer.
  2. Enum and a big switch statement. I tried something similar a few months ago and found it didnt do what I wanted. SourceBoost function pointers are not what you expect, have a look at an assembler listing, the compilor assigns a number to each function pointed to (starting at 0) and when a function pointer is invoked it calls a hidden assembler function which is a big switch. The compilor seems to detect what functions are pointed to by looking for them being assigned to function pointers. It doesnt recognise a table of function names. If you dont like surprizes I suggest you also h
  3. How about shareing the answer so people can find it in the future.
  4. This series of chips uses a new way of doing configuration words, I am guessing that the PIKIT2 does not know about it and so throws a warning. Maybe the manufacturers have a software upgrade.
  5. Those cheeky chappies at Microchip have added a new twist to keep us on our toes. This series of chips requires config words in program space which are automagically loaded into 0x300000 on power up. See table 5. 1 on page 68 of the data sheet, this shows the program memory locations to store the config words.
  6. This option was available on the old C2C but then again at one time that had a bit of a problem with interrupts on PICs that didnt have a common bank, eg PIC16F873. There is a way round but it is somewhat involved.
  7. A number of problems BoostC saves context automatically so you dont have to. The file is called pclath not pclatch Saving context at location 0 onwards is not a good idea because you have to deal with file banking (and thus destroy the status file contents). You would do better saving in the common memory area. IE the area mirrored across all files.
  8. BoostC uses internal functions to perform certain mathematical functions, in this case one called __rem_16_16. BoostC does not use a stack for local variable so its generally not a good idea to call a function from more than one execution thread. You could try useing different data types (signed, unsigned, int, char)in the main and interrupt thread (different data types have different functions, at a guess for char % char one called __rem_8_8).
  9. The compilor doesnt use FSR1, (none of my code has so far) not sure why. It would be neater to use a different FSR set for each thread, though this would add to the complications of calling functions from two threads. You can prevent context saving with the linker switch -isrnocontext, Pic 18 only
  10. The programmer should know which SFRs (s)he has used and should know which ones require preserving during an interrupt. However the compilors use of PRODH and PRODL is hidden from the programmer, so these registers are preserved so that multiply operations can be performed in the main and both isr threads.
  11. Ive been caught by this one before observe the addresses of the instructions 01C8 label29 01C8 30C8 MOVLW 0xC8 <---- 01C9 0237 SUBWF gbl_x, W ^ 01CA 1803 BTFSC STATUS,C ^ 01D7 0AB7 INCF gbl_x, F ^ 01D8 29C8 GOTO label29 ---------- >^
  12. Read this thread by ra68qi http://forum.sourceboost.com/index.php?showtopic=2399 Its available in SourceBoost support forum > PIC and SX Embedded Programming > BoostC and C2C compilers as a sticky thread The first few lessons are basic led and button twiddling. Lesson 10 deals with using a timer to generate a tick. lesson 11 expands on this to make a clock I advise working through carefully DO NOT dive straight in to lesson 11. Also consult the app notes on Microchips website. There may be one on interfacing an LCD However note that setting up an LCD is not a trivial ta
  13. Sorry Dan, thats a pretty unfortunate set of circumstances, with it being the beginning of term at so many colleges and having heard so many stories before (ranging from "dog ate homework", "sister died", "I am an eminent professor and I need to check my answers before I set these questions to my students") I tend to be a little sceptical. A forum is not going to be the best place to get this resolved, forums are better suited to answering specific questions about a problem. BTW I believe Dave and Pavel who wrote SourceBoost do contract work, maybe the can help! See http://www.sourc
  14. We hope you enjoyed this story, if you would like to read more may I suggest you visit http://forum.java.sun.com/forum.jspa?forumID=31 Yes folks, its that time of year again
  15. I suggest aquiring the knowledge! Start with something smaller, write a program to make the LED flash on and off, then write a program to read the button and turn the LED on when the button is pressed and off when the button is released, write lots of similiar small programs, experiment.
  16. Theres your problem, imagine you are in main and are in the function that is seven deep, if an interrupt occurs the stack will be full, when th interrupt calls its function the stack will overflow. You may have a hidden function call in your interrupt, sourceboost uses built in functions to perform tasks such as multiplication or accessing data from an array in codespace.
  17. The tree window does not seem to tailor itself to the processor in use. I am using a PIC18 and the tree shows all functions below 8 deep in red. I was rather curious as to why they were red, it wasnt until TF's question that I realised why.
  18. It depends on the PIC you use, most PIC16 have a stack depth of 8, a few have a depth of 2, most PIC18 have a depth of 31. If you click on a + box it opens up to show further branches, Im guessing that any function names in red are causing the problems. Be aware that using interrupts reduces the available stack depth, calling functions in interrupts reduces further. There is another solution, BoostC (from I think version 6.50) can implement a software stack. See page 22 of the BoostC manual about linker option -swcs.
  19. You need to see the call tree. There are two ways of doing this, either open the text file generated by Sourceboost in your project directory named after your project with the suffix "tree" or open the tree browser in the Sourceboost IDE. select Menu->View->Code Bar In the Code Bar window select the call tree tab.
  20. Looking at the data sheet Each of the PORTA pins, except RA3, has an individually configurable internal weak pull-up. Control bits WPUAx enable or disable each pull-up. Refer to Register 4-4. Each weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are disabled on a Power-on Reset by the RABPU bit of the OPTION register. A weak pull-up is automatically enabled for RA3 when configured as MCLR and disabled when RA3 is an I/O. There is no software control of the MCLR pull-up. Id say you need a pull up resistor.
  21. I would not expect it to work. However I decided to see what another C compiler would do, I dont have gcc so I tried it with Borland CBuilder, it did work however the linker issued a warning regarding multiple declarations.
  22. The problem is with SourceBoost's implementation of call by reference. The referenced variable is copied to a variable local to the function. When the function returns it copies its local variable back to the referenced variable. I'm guessing it is done this way to save a lot of fiddling with pointers, something that PICs are not well equipped for. This seems to work well for most cases however it does fall over when the referenced variable is accessed from another thread (been there) and can make a function that is calling by reference a large struct somewhat larger in code size a
  23. There are also a number of us moderators around the world in different time zones who can approve posts. When I became a moderator I got to see just how much spam this site gets and having read some I have learnt many new uses for battery powered vegetables.
  24. The semicolon is at the end of clear_wdt() A while format is while (condition) statement; Statement can be nothing, a block or a single statement, in his case the single statement is the if. Code like this could be formatted a lot clearer.
×
×
  • Create New...