16f88 help


Closed Thread
Results 1 to 5 of 5

Thread: 16f88 help

  1. #1
    ccsparky's Avatar
    ccsparky Guest

    Default 16f88 help

    Hello

    I am attempting to use the DS1307 RTC and the 25LC640 spi eeprom with the 16f88 and have a few set up questions.
    I went with the 16f88 because of the large code space availible.
    I am using PICBasic Pro with MicroStudio Plus. I want to use the bootloader feature and have hooked up the 16f88 on my breadboard according to the diagram provided in the help file.
    I am not sure how to set this chip up so any help in the area is greatly appriciated! First here is how I have my chips wired...

    RA6 ----- Oscillator
    RA7 ----- Oscillator
    RB0 ----- eeprom CS pin
    RB1 ----- DS1307 Data pin
    RB2 ----- rs232 pin 11 (T1 IN)
    RB3 ----- eeprom SCK pin
    RB4 ----- DS1307 Clock pin
    RB5 ----- rs232 pin 12 (R1 OUT)
    RB6 ----- eeprom SI pin

    I will be using other additional pins for digital i/o and do not need any anolog input. So I would like to turn off the anolog feature.
    Here is what I have for the setup. Do I have mistakes or am I missing some items?

    Define LOADER_USED 1
    Define osc 4

    Include "MODEDEFS.BAS"

    ADCON1=6
    TRISA = %00000000
    TRISB = %00000100

    'pins
    CS VAR PORTB.0 'EEProm CS Line
    DS_SDA var PORTB.1 'DS1307 Data Pin
    SO con PORTB.2 'Serial Output
    SCK VAR PORTB.3 'EEProm SCK Line
    DS_SCL var PORTB.4 'DS1307 Clock Pin
    SI con PORTB.5 'Serial Input
    SI VAR PORTB.6 'EEProm SI Line

    Any help or suggestions would be appriciated!

    I have both the 4 and 20 mhz ocillators. Would it be better to go with the 20mhz ocillator?

    Thank you
    William

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


    Did you find this post helpful? Yes | No

    Default

    If you decide to use 20MHz then obviously change the DEFINE OSC statement. Whether you decide to go 20MHz depends if you can satisfy your application requirements whilst running at 4MHz. 4MHz parts are usually cheaper in production.

    If you used a 24LC512, then it could have shared the I2C bus with the DS1307 and save yourself a heap of PIC pins in the process. As it is you've forgotten about the EEPROM's SO pin unless of course the EEPROM is going to be used as a WRITE ONLY device (ie datalogger application and you're going to crow-bar* it off the circuit-board to read-back)...

    *Crow-Bar is a Bristish term for a chip-extractor/removal tool aka 'Wrecker-Bar' in the USA.

  3. #3
    ccsparky's Avatar
    ccsparky Guest


    Did you find this post helpful? Yes | No

    Default 16f88 help

    Hello Melanie
    Thank you for the help!

    I had both the DS1307 and 25LC640 from a BX-24 (NetMedia) project but will look into the other chip.

    I have been following the setup from "Experimenting with the PicBasic Pro Compiler" by Les Johnson and have the SO pin tied to the SI pin as indicated in the drawing.
    I forgot Include 25XXXX.INC
    Other than this how does the rest of the set up look?

    Thanks again!

    William

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


    Did you find this post helpful? Yes | No

    Default

    You've used 'con' instead of 'var' in a couple of your pin defines...

    SO con PORTB.2 'Serial Output
    SI con PORTB.5 'Serial Input

    and you've duplicated the use of SI.

    SI con PORTB.5 'Serial Input
    SI VAR PORTB.6 'EEProm SI Line

    Make your mind up about defining your Serial Comms pins...

    RB2 ----- rs232 pin 11 (T1 IN) - Input or Output?
    SO con PORTB.2 'Serial Output - here it looks like an Output...
    TRISB = %00000100 - but here you've defined it as an input...

    same for the other pin at RB5...

    Hell, I'd hate to go out for dinner with you... "I'll have Lobster... nope I'll have the Steak... nope I'll have the Lobster..."

    Look, you've chosen the pins to coincide with the Hardware USART (which is a good move as it gives you both Hardware and Serial software options to play with later in your code), so set the definitions accordingly (which you HAVE done CORRECTLY with TRISB)... and lose the confusing comments... and lose confusing definitions. What is 'SO'? Serial Output? Wrong pin if you're planning to use the USART Hardware and wrong for your setting of TRISB.2.

    SerialReceive var PortB.2 ' RS232 Input
    SerialTransmit var PortB.5 ' RS232 Output

    Unless you're Forrest Gump it'll confuse the hell out of you otherwise.

    Bet you now regret asking me for my comments...

    *smiles*

    Finally, don't forget RA5 is an INPUT ONLY pin if you're planning to use it for I/O and set TRISA appropriately.

  5. #5
    ccsparky's Avatar
    ccsparky Guest


    Did you find this post helpful? Yes | No

    Default

    Ok, ok

    But I like the steak and lobster combination :-)

    I am not sorry I asked! I would have missed out on the laughter!
    Hey, thanks for the help. I'll review what I have and think a little harder before I post!

    Thanks

    William

    If you are ever in Nevada the lobster or the steak or the lobster is on me!

Similar Threads

  1. Code works on 16F84A but not on 16F88?
    By pharaohamps in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th November 2009, 18:29
  2. Can't get a 16F88 to do anything.
    By ccowley in forum General
    Replies: 14
    Last Post: - 25th August 2008, 23:42
  3. Output settings for 16F88
    By PICante in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 22nd June 2008, 14:03
  4. 16F88 RA6 and RA7 troubles
    By gandora in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd August 2007, 02:57
  5. 4 line LCD with 16F88
    By anj in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2004, 09:06

Members who have read this thread : 1

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