16F877 Programming (newbie)


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    >Normal execution of the program thereafter disregards the DATA line??

    Yes. The DATA statement simply presets the content of EEPROM at PROGRAM TIME - ie when you burn the PIC in your programmer. The DATA statement is not actually an 'executable' piece of code. It carries no program overhead. It is simply a directive to place values into EEPROM when the PIC is programmed. Thereafter, the content of EEPROM can be read (with the READ command) and altered (with the WRITE command) as often as you want during program execution. So to recap, DATA presets the EEPROM to an initial value at PROGRAM TIME - and at no other time thereafter (unless you reprogram the PIC in your programmer when the value will revert back to that specified by the DATA statement - unless of course you have a clever programmer in which you can specify if the EEPROM contents are to be programmed or not).

    >>So is each LOCATION one 8-bit byte long?

    Yes.

    >>If so, how can you store 16 bit words??

    You split the word into highbyte and lowbyte and use two EEPROM locations.

  2. #2
    Join Date
    Jul 2007
    Location
    Grass Valley CA
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    Many thanks fer yer help. The derivative of the learning curve is a large positive number today.

    Two last questions and I'm pretty sure that I know the answers ... which is generally how I get bit on the hiney from time to time ...

    1.) If I am in a particular section of the main program and I call out a subroutine called, for example getthis: and in getthis: it calculates a variable called rxp2 and gives it a value of 7 (i.e. somehow rxp2=7 is generated), when I RETURN to the main program and use rxp2, does it still have the value 7 if it otherwise hasn't been modified? I think the term for this is global variable, where it matters not where in the program something is calculated, it carries that value everywhere in the program until modified somewhere else.

    2.) Does it take up any more program space to call a variable s2 or supercalafragialisticexpialidotious2 ??? And are we limited in length on variable names?

    (Or is there a place online where I can go to look up information like this rather than bugging you all afternoon?)

    Jim

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Actually, where I am now is pretty much midnight...

    1. All variables in PICBasic are global.

    2. Labels or variable names do not take up program space... make them meaningful, but if you go crazy with them, it makes your program look stupid (but then again, who cares, you're the one that's probably only going to read it and it's unlikely you're going to publish it for a wider audience to riddicule)...
    Code:
    If (PrimaryStallAlarmWarningFlag=1 and PrimaryWheelsUpFlag=1 and WheelsNotDownAndLockedFlag=0) then goto YoureGoingToBendYourPropellerVoiceMessageWarning
    Try to make things fit on one line - it makes printouts and debugging so much easier.

    With PBP - it's all in the manual and in the Datasheet for the PIC you're using.

Similar Threads

  1. Blink.Bas on 18f45k20 Newbie seeks working example.
    By DiscoEd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th December 2009, 03:36
  2. Data Programming Error at 0000
    By cpatnoi in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd May 2009, 03:37
  3. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 16:51
  4. Replies: 6
    Last Post: - 1st February 2008, 03:35
  5. PIC 16F877 programming help
    By the_piculiar in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th July 2005, 22:39

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts