• AVR Freaks

Hot!USART 16F688 please help!

Author
ollyk
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2016/06/23 01:21:06
  • Location: 0
  • Status: offline
2018/06/08 01:41:21 (permalink)
0

USART 16F688 please help!

Not the first time I have had problems with this device with USART and unfortunately I can't remember what they were previously and how I got round them! 

Basically having problems transmitting what I am sending to the TXreg. Please see below with my code and what I get from Pickit serial.


 
Anyway, Running off 20Mhz external TTL crystal, output to 15200. output slowed down way too much but I am just pulsing an LED to indicate output and loop good to eliminate the silly. 
 

I think this is a serious case of 'not seeing wood for trees'!
 
#include <p16F688.inc>
__CONFIG _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _FOSC_EC
;& _IESO_OFF & _FCMEN_OFF & _CPD_OFF
;_INTRC_OSC_NOCLKOUT
;_XT_OSC
;_INTRC_OSC_NOCLKOUT
;*****************************************************************************
cblock 0x20
removed for clarity
endc
org 0

bcf STATUS,RP0
bcf STATUS,RP1
clrf PORTA
clrf PORTC
 
movlw 0x07
movwf CMCON0 ; turn comparators off


;-------------------------------BANK 1-------------------------------
bsf STATUS,RP0 ; Select Bank 1
;-------------------------------BANK 1-------------------------------
movlw b'01110001' ;Configure to 1Mhz (surce set by FOSC(2:0)
movwf OSCCON
clrf ANSEL ;Disable A2DC
clrf WPUA ; No pullups

movlw b'00000111' ;use Prescale 1:1
movwf OPTION_REG

movlw b'11111101' ; All A in apart from (LED)
movwf TRISA ; all portA inputs
movlw b'00000000' ; Set up PORTC 4&5 as inputs for serial comms
movwf TRISC ;
;-------------------------------BANK 0-------------------------------
bcf STATUS,RP0 ; Bank 0
;-------------------------------BANK 0-------------------------------
PREIN:
clrf TXSTA
clrf RCSTA

movlw 0x00 ; brgh = high no parity 
movwf SPBRGH
movwf BAUDCTL
movlw 0x0A ; (0x0C=19200 bps) (0x33@8Mhz = 2400) (0x0A = 115.2k)
movwf SPBRG
movlw b'10010000' ; enable Async & Reception, 8 bit
movwf RCSTA
movlw b'10100100'
movwf TXSTA

;----------------------------END OF CONFIG---------------------------
STT:
bsf PORTA,1
call DLY1S
bcf PORTA,1
call DLY1S
bsf PORTA,1
call DLY1S
movlw 0xAA
movwf TXB
call TXbuff
goto STT



 
TXbuff:
btfss PIR1,TXIF
goto $-1
movf TXB,w
movwf TXREG
return
 
 
 
 

Attached Image(s)

#1

11 Replies Related Threads

    Jams100001
    Starting Member
    • Total Posts : 57
    • Reward points : 0
    • Joined: 2018/04/12 13:37:33
    • Location: MCHP Chandler
    • Status: offline
    Re: USART 16F688 please help! 2019/04/18 14:21:06 (permalink)
    0
    Hey OllyK,
    did you ever figure this out?
    Jamus
    #2
    katela
    Super Member
    • Total Posts : 1228
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: USART 16F688 please help! 2019/04/18 15:10:30 (permalink)
    0
    ...

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #3
    Jams100001
    Starting Member
    • Total Posts : 57
    • Reward points : 0
    • Joined: 2018/04/12 13:37:33
    • Location: MCHP Chandler
    • Status: offline
    Re: USART 16F688 please help! 2019/04/18 15:16:14 (permalink)
    0
    Katela,
    I was asking because I am assigned to this post and I wanted to make sure they still needed assistance otherwise I can close this case.
    Thank you,
    Jamus
    #4
    katela
    Super Member
    • Total Posts : 1228
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: USART 16F688 please help! 2019/04/18 15:23:53 (permalink)
    0
    I realized that later, that's why I removed my comments.

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #5
    dan1138
    Super Member
    • Total Posts : 3067
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: USART 16F688 please help! 2019/04/18 19:01:30 (permalink)
    +1 (1)
    Jamus_Griego_Microchip
    I was asking because I am assigned to this post and I wanted to make sure they still needed assistance otherwise I can close this case.

    So you are working to resolve an issue posted a year ago for a PIC16F688.
     
    This is what Microchip assigned you to do?
     
    Was this before or after they sent you to find the local nesting site of the Arizona spotted snipe?
    post edited by dan1138 - 2019/04/18 19:02:38
    #6
    PStechPaul
    Super Member
    • Total Posts : 2210
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: offline
    Re: USART 16F688 please help! 2019/04/18 22:18:28 (permalink)
    +1 (1)
    The OP has several additional posts, as recently as 3 weeks ago. None of them seem to be about this issue and he might be using newer devices now.
     
    Issue may have been resolved here: https://www.microchip.com/forums/m1060073.aspx
    post edited by PStechPaul - 2019/04/18 22:22:11

     
    #7
    ollyk
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2016/06/23 01:21:06
    • Location: 0
    • Status: offline
    Re: USART 16F688 please help! 2019/04/19 03:35:56 (permalink)
    0
    Hi folks thanks for the heads up yes I think I solved this issue but cannot remember for the life of me what the outcome was. Probably missing the obvious, I find that too easy!

    I vaguely remember the simulator caused confusion because everything worked but just not in real life.

    Case can be closed now.
    #8
    crosland
    Super Member
    • Total Posts : 1569
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Bucks, UK
    • Status: offline
    Re: USART 16F688 please help! 2019/04/19 08:06:06 (permalink)
    +1 (1)
    This is a forum, you don't "close cases" on a forum.
     
    #9
    1and0
    Access is Denied
    • Total Posts : 9040
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: USART 16F688 please help! 2019/04/19 10:13:48 (permalink)
    +1 (1)
    Jamus_Griego_Microchip
    I was asking because I am assigned to this post and I wanted to make sure they still needed assistance otherwise I can close this case.
    Thank you,
    Jamus

    When has Microchip started doing this? Assigning forum posts and closing them???
    #10
    crosland
    Super Member
    • Total Posts : 1569
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Bucks, UK
    • Status: offline
    Re: USART 16F688 please help! 2019/04/19 11:32:48 (permalink)
    +1 (1)
    It's great if Microchip techs are being assigned to help with issues raised on the forum but I worry about what the notion of closing forum posts indicates about the level of support that might be forthcoming.
    #11
    Jams100001
    Starting Member
    • Total Posts : 57
    • Reward points : 0
    • Joined: 2018/04/12 13:37:33
    • Location: MCHP Chandler
    • Status: offline
    Re: USART 16F688 please help! 2019/04/22 08:13:43 (permalink)
    +1 (1)
    Hey everyone,
    For the record, I'm not closing the post just the case which was assigned to me here at microchip. Most of the folks on the forum help out enough to where we are not needed but once in a while, no one responds. I was just checking to see if Ollyk still needed help before I waste my time working on something which was resolved another way.
    Thanks all,
    Jamus  
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5