some days I hate pic's (serout,gsm,usb,f88)


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default some days I hate pic's (serout,gsm,usb,f88)

    Yesterday I wrote a simple program


    Loop:

    high porta.0
    pause 500
    low porta.0
    pause 500
    high porta.0
    pause 500
    low porta.0
    pause1000

    serout porta.1, N9600,["AT",13,10]

    goto loop.


    simple, flash led and send AT down a 1k resistor to my serial port.

    Worked a treat. left hyperterminal running and showing AT for hours...


    Got an old phone datacable, hacked into the wires, its only a max232 in a moulded plug, connect it to the pic, looked at monitor, nothing on screen, occasional garbage......

    How can this be? the simple and dirty resistor trick works, the 'proper' way with a level shifter isnt working?

    Ha! I should use T9600.............

    Nothing.....

    OT9600, nothing.

    Back to the simple resistor, all is fine, so I have not upset the pic.....

    9600 on a 4mhz, emm, I'll drop to 4800, oh hang on compiler error, better make that 2400..........


    Maybe I have killed the old phone data cable?

    get another one! this ones not a max 232 but a pl203 usb one, nothing......

    Reconnect them up and test them on the phone, thats ok.

    connect the two datacables together! put one on com 1 and the other on 5, oh look what I type in one window appears in the other!

    Connect both to the pic, nothing.............garbage............

    At this point I was going to go sit in the garden and break out a beer.

    I decided it must be voltage levels, so started to play with a 1k resistor between pin Ra1 and gnd and 5v, no real improvement, very odd...

    I remember something about port A pullups and problems, so I changed to code to serout on portb.6.........

    That was it, all problems fixed.......

    At this point I dont care anymore, I'll just never use port A again!

    Odd that even on portb, using no pullups or anything both OT2400 and T2400 appear on both the max232 and the pl2303

    Best news is I have connect the pic to my phone, and one of the cables, and can see the phone echoing back whats sent, so I'll soon have my house/car alarm....

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    At this point I dont care anymore, I'll just never use port A again!
    i have no problem with that... if i disable analog stuff before. On PORTA... there's big chance.

    Wich PIC?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    i have no problem with that... if i disable analog stuff before. On PORTA... there's big chance.

    Wich PIC?

    The good ol' F88.

    I want to write the code on the 2550, but it wont fit in my programmer and I have not yet made a header, or the pcb for my project, if I had, I could have used ISP on the 2550.....

    So I just grabbed a F88 off my serial relay project and erased it, started on that one.

    I cant see why if the Pic running at 5v can drain enough current through port A to make the PC serial port see data, why it cant make a max 232 see data when its pumping 5v into a 5v input..............

    Other odd thing is all my port a's and port b's have 1k resistors and leds on, that way I can 'see' when data is being thrown out, on port B the led is brighter than on port A.......

    Setting the port pins high with the 'high portx.y' cause the leds to be the same brightness, on either port a or b.

    If there the same brightness, it cant be the pic's port is not sourcing as much current, they the same, but with a serout command they are not the same brightness, so whats going on!

    either its a pic chip thing, or a compiler thing setting something different, or not setting something 'extra' that port A needs to source as much current in serout mode as port B does.

    I would like to know whats going on, as both should work and only one is, but I'm not letting it slow me down I can live with only using port B for now while I test the code snippets, and I was using port B on the final board design anyway, was just annoyed at losing nearly a day to find a solution thats a problem caused by an 'undocumented feature'

    Now I need to find a way to store 150 bytes of 9600 baud incoming data and pics have no strings IIRC

    Its no doubt in a manual somewhere.................

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Ok so at least you never opened the PIC16F88 datasheet and discover what's multiplexed on PORTA and if it's enable by default? Right?

    Once done, you'll know why.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    Ok so at least you never opened the PIC16F88 datasheet and discover what's multiplexed on PORTA and if it's enable by default? Right?

    Once done, you'll know why.
    I read the picbasic manual instead, it said if thou use that pin for serial, it shalt do serial.

    Which it does, but just not as efficiently, and only to some devices...........


    If I set the port pin high with a high command, I get the same voltage on the pin as any other I set high, I dont have to worry about whats multiplexed on it / other uses it has, so why should the serout command not set everything up also?

    In the manual little notes are included about other pic's with ''odd'' behaviour so I just presumed this had none to worry about.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    it's not odd or curious.. it's normal. You're working with digital signal on analog by default I/o.

    Open the PIC16F88 datasheet and discover the Analog section... section 12.0 and 13.0.

    Now you need to disable the analog stuff
    section 12.0 register 12-1 ANSEL:
    ANSEL=0 ' set all related i/o to digital mode

    Section 13.0 register 13-1 CMCON (and figure 13-1)
    CMCON=7 ' Disable analog comparator

    ok those comparator are already disabled by add the line just for safety sake

    So add
    ANSEL=0
    CMCON=7
    at the top of your code.
    About now?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Communicating between two PICs over DC bus
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th May 2009, 12:57
  2. Sharing Max232 with two pics?
    By zx81sp in forum Serial
    Replies: 10
    Last Post: - 28th April 2009, 22:22
  3. Retrieving infos from multiple PICs on a bus/chain
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th October 2007, 04:42
  4. Programming Pins of PICs?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th August 2007, 18:59
  5. Self Destructing pics? Copy protection
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd March 2004, 09:39

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