1. jimtr6

    Thread Starter New Member

    Jun 16, 2010
    6
    0
    Hi, I'm completely new to pics, I ordered some pics, a programmer, and a program called FlowCode because I like the visual aspect of flowcharts and want to simplify getting into pics as much as I can. The FlowCode program has program simulation which seems to be a great advantage. Is anybody here familiar with this program? Any suggestions for a complete novice in getting started? any and all help appreciated...thanks, jim
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    In this thread http://forum.allaboutcircuits.com/showthread.php?t=39603 the OP claim to have used Flowcode. The output is perhaps correct but a mess. I think the best way to learn C is by doing coding the hard way. Remember to not start with to complex projects in the beginning. Let your learning curve decide what to do next
     
  3. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    905
    I am just a novice to PIC coding and share your fondness for flowcharts. I started with Assembly, which is well suited for converting simple flow charts into code. Even if you eventually move to C, you may find a benefit in doing the first few simple programs in Assembly.

    John
     
  4. jimtr6

    Thread Starter New Member

    Jun 16, 2010
    6
    0
    Thanks, good advice, is the language I should get familiar with have instructions such as "BSF 03h,5" which does make sense to me as in setting bit 5 high at address 03, is this what they call assembly code or mnemonics? What I simply want to get familiar with first is reading ports (specific bits in that port) whether a high or low and learn to make a decision based on the input and program and send a desired output. thanks much for your help....jim
     
  5. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Agreed. Assembly is a good way to learn the actual functions that are happening in the uC.

    If you ever have a problem in C finding the right command, you can call the assembly code from the C code to perform the task.
     
  6. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    905
    Download the Datasheet for the PIC controller you want to use. Everything you need to know is there. A tutorial will help you learn how to use it. The instruction "BSF" is assembly. For the 16F690, for example, Chapter 15 has all of the instructions and syntax. Table 15-2 is particularly helpful. See: http://ww1.microchip.com/downloads/en/DeviceDoc/41262E.pdf

    John
     
  7. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Before you start programming read section 14. Correct setting of the Processor Configuration Bits is important. You can set these bits in MPLAB or the code by using the __config statement. At the end of the include file for the chip, you will find a list over valid settings(true for both C and ASM). I often past this as comment into the code.
    example
    Code ( (Unknown Language)):
    1.  ;==========================================================================
    2. ;
    3. ;       Configuration Bits
    4. ;
    5. ;==========================================================================
    6.  
    7. ;_FCMEN_ON                    EQU     H'3FFF'
    8. ;_FCMEN_OFF                   EQU     H'37FF'
    9. ;_IESO_ON                     EQU     H'3FFF'
    10. ;_IESO_OFF                    EQU     H'3BFF'
    11. ;_BOR_ON                      EQU     H'3FFF'
    12. ;_BOR_NSLEEP                  EQU     H'3EFF'
    13. ;_BOR_SBODEN                  EQU     H'3DFF'
    14. ;_BOR_OFF                     EQU     H'3CFF'
    15. ;_CPD_ON                      EQU     H'3F7F'
    16. ;_CPD_OFF                     EQU     H'3FFF'
    17. ;_CP_ON                       EQU     H'3FBF'
    18. ;_CP_OFF                      EQU     H'3FFF'
    19. ;_MCLRE_ON                    EQU     H'3FFF'
    20. ;_MCLRE_OFF                   EQU     H'3FDF'
    21. ;_PWRTE_OFF                   EQU     H'3FFF'
    22. ;_PWRTE_ON                    EQU     H'3FEF'
    23. ;_WDT_ON                     EQU     H'3FFF'
    24. ;_WDT_OFF                    EQU     H'3FF7'
    25. ;_LP_OSC                      EQU     H'3FF8'
    26. ;_XT_OSC                      EQU     H'3FF9'
    27. ;_HS_OSC                      EQU     H'3FFA'
    28. ;_EC_OSC                      EQU     H'3FFB'
    29. ;_INTRC_OSC_NOCLKOUT          EQU     H'3FFC'
    30. ;_INTRC_OSC_CLKOUT            EQU     H'3FFD'
    31. ;_EXTRC_OSC_NOCLKOUT          EQU     H'3FFE'
    32. ;_EXTRC_OSC_CLKOUT            EQU     H'3FFF'
    33. ;_INTOSCIO                    EQU     H'3FFC'
    34. ;_INTOSC                      EQU     H'3FFD'
    35. ;_EXTRCIO                     EQU     H'3FFE'
    36. ;_EXTRC                       EQU     H'3FFF'
    37. #include <p16F690.inc>
    38.      __config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
    39.      org 0
    40. Start:    
     
  8. jimtr6

    Thread Starter New Member

    Jun 16, 2010
    6
    0
    I think I see, so what you do first is configure which makes perfect sense, bear with me a bit (no pun intended)....what does the following code mean, is FCMEN_ON a name you chose that equals the value of 3FFF (in hex) or is 3FFF an address with a value in it. Should I look at something like FCMEN as a shortcut that you will use somewhat often and therefore rather than typing code you type FCMEN? Again thanks for your time....jim
    _FCMEN_ON EQU H'3FFF'
     
  9. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    As I said read section 14, in the data sheet;) The different options are combined with logical and to form the configuration word (ref section 14 also).
     
  10. jimtr6

    Thread Starter New Member

    Jun 16, 2010
    6
    0
    I think I see, for example if I wanted to reuse the chip for different programs I would set bits 6 and 7 high (CP and CPD). In the code below for CP on is 3F the register address and BF the config word?
    ;_CP_ON EQU H'3FBF'
    ;_CP_OFF EQU H'3FFF'
     
  11. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Yes that is correct If you want CP off you do something like this __config(...... & _CP_OFF
     
Loading...