HSERIN2 Problem on 18F23k22


Closed Thread
Results 1 to 4 of 4
  1. #1
    ethobias's Avatar
    ethobias Guest

    Default HSERIN2 Problem on 18F23k22

    Hi
    I have a problem when trying to use the HSERIN2 command on a 18F23k22. It simply doesnt work. HSERIN works perfectly.
    In the code below I am sending one Byte from my PC and would like to read the same byte sent back.
    It works on HSERIN but not on HSERIN2!

    CM1CON0 = $00 ;Comparator disabled
    CM2CON0 = $00 ;Comparator disabled
    ANSELA = $00 ;Analog input disabled
    ANSELB = $00 ;Analog input disabled
    ANSELC = $00 ;Analog input disabled

    include "modedefs.bas"
    Define OSC 16
    Define HSER_RCSTA 90h
    Define HSER_BAUD 9600
    Define HSER2_RCSTA 90h
    Define HSER2_BAUD 9600

    Define HSER_CLROERR
    Define HSER2_CLROERR
    OSCCON = $70 ;FOSC 16MHz
    ;OSCTUNE = $40 ;PLL Enabled


    input portc.7 ;HSERIN1
    input portb.7 ;HSERIN2

    RXByte1 var Byte
    RXByte2 var Byte

    mainloop:

    HSERIN2 [RXByte1]
    Serout Porta.5, T9600, [RXByte1]
    Goto mainloop
    End

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default Re: HSERIN2 Problem on 18F23k22

    Hi ethobias,

    Apparently, Microchip has changed the size of the ACCESS bank on this family.
    So the HSER2 DEFINEs are not working.
    We need to fix that. But in the mean time you can use these statements instead of the DEFINEs.

    Code:
    RCSTA2 = $90 ' Enable serial port & continuous receive
    TXSTA2 = $20 ' Enable transmit, BRGH = 0
    SPBRG2 = 25  ' 9600 Baud @ 16MHz, 0.16%
    DT

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

    Default Re: HSERIN2 Problem on 18F23k22

    Really? I thought direct register config didn't worked for HSERIN(2).

    EDIT: Nevermind, it's a workaround...
    Last edited by mister_e; - 20th May 2011 at 23:19. Reason: blonde moment... or not.
    Steve

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

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default Re: HSERIN2 Problem on 18F23k22

    Well, I started working on a fix for this problem today, and found out there wasn't a problem after all.
    Apparently I was looking at the wrong datasheet.

    Testing of the program from post #1 passed on an 18F23K22.

    ethobias,
    Can you tell me more about your setup?
    Are you still having a problem?
    DT

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