18f25k22 hserin


+ Reply to Thread
Results 1 to 18 of 18

Thread: 18f25k22 hserin

Hybrid View

  1. #1
    Join Date
    Jan 2022
    Posts
    42

    Default 18f25k22 hserin

    Hello,

    I've tried to use the Hserin with no success, let me explain,

    I used the example from the PBP3 compiler reference manual p:150

    and scanning with hand barcode scanner nothing show or random character show up on the serial terminal.

    the scanner is set at 9600,8,1,n and it's working on other application

    I'm looking for the code to wait until I scan a code then it send to a serial port and come back waiting for the next scan.

    is there someone who can help.

    thanks to everyone



    [/
    Code:
    '-------------------------------------------------------------------------
    ' Name  : Hserin Test  (18F25K22)
    ' Serout Baud rate: 188:4800,84:9600,49:14400,32:19200,15:28800,6:38400  'ok
    ' Serout : p296,297
    ' 9600 Open Inverted None 49236
    ' HSERIN [WAIT("!"), STR MyArray\200, STR MyArray(200)\200, _
    ' STR MyArray(400)\200, STR MyArray(600)\100]
    '
    '-------------------------------------------------------------------------
     Include "modedefs.bas" ' Include serial modes
    ;----[18F25K22 Hardware Configuration]------------------------------------------
    #CONFIG
      CONFIG  FOSC = INTIO67
      CONFIG  PLLCFG = On   
      CONFIG  WDTEN = Off       
      CONFIG  MCLRE = INTMCLR   
      CONFIG  LVP = Off
    #ENDCONFIG
    
    
        ANSELA = 0  ; All Digital
        ANSELB = 0
        ANSELC = 0
    DEFINE OSC 64                     
    TRISA = 111111    '1:IN, 0:OUT             
    TRISB = 111110
    TRISC = 111111                   
    OSCCON = $70
    OSCTUNE = $40                     
    
    
    
    
    ' Set receive register to receiver enabled
    DEFINE HSER_RCSTA 90h
    DEFINE HSER2_RCSTA 90h
    ' Set transmit register to transmitter enabled
    DEFINE HSER_TXSTA 20h
    DEFINE HSER2_TXSTA 20h
    ' Set baud rate
    DEFINE HSER_BAUD 9600 
    DEFINE HSER2_BAUD 9600
    DEFINE HSER_CLROERR 1
    
    
    
    
    AArray VAR BYTE[12]
    BArray VAR BYTE[12]   
    
    
    
    
    ' code to scan sample : 0 59749 96859 1                     
    MAIN:                             
    
    
    HSERIN [wait ("0"), str AArray\12]
    serOut2 PORTB.0,84, [str BArray\12,13,10]
    
    GoTo MAIN
    
    
    
    
    

    Attached Images Attached Images  
    Last edited by jackberg1; - 19th January 2025 at 02:04.

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    I don't have the manual in front of me now, but I think that you are missing some parameters in the HSERIN command.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  3. #3
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    the manual is in PDF format.

    Let me know what is missing when you can.

    from the data sheet only 3 setup as to be done for receiving.


    Name:  Untitled-2.jpg
Views: 1903
Size:  112.6 KB


    thank you
    Last edited by jackberg1; - 19th January 2025 at 03:25.

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  5. #5
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    Also, HSERIN starts saving the variables after the WAIT requirement has been met. In your case, it will only save 11 numbers instead of 12.

    Code:
    ' code to scan sample : 0 59749 96859 1                     
    MAIN:                             
    
    
    HSERIN [wait ("0"), str AArray\11]
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  6. #6
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    I rectified it (hserin 5,MAIN,[STR AARRAY\12])

  7. #7
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    here's the code from today post:

    HSERIN [wait ("0"), str AArray\12]
    serOut2 PORTB.0,84, [str BArray\12,13,10]

  8. #8
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    Thanks for your time, I'll look at it, also I did used a timeout label (hserin 5,MAIN,[STR AARRAY\12])
    still no result.

    Thanks again.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    Works ok for me if BArray has something printable placed in it

    perhaps u wired it up incorrectly
    Warning I'm not a teacher

  10. #10
    Join Date
    Jan 2022
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: 18f25k22 hserin

    Quote Originally Posted by richard View Post
    Works ok for me if BArray has something printable placed in it

    perhaps u wired it up incorrectly


    even this

    MAIN:
    hserin 5,MAIN,[STR AARRAY\12]
    serOut2 PORTB.0,84, [str aarray\12,13,10]
    GoTo MAIN

Similar Threads

  1. Hserin
    By Dinoden in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th December 2016, 04:16
  2. 18F25K22 Help
    By ERMEGM in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 25th November 2014, 10:36
  3. migration from 16F876a to 18F25k22
    By MOUNTAIN747 in forum General
    Replies: 26
    Last Post: - 19th March 2012, 21:33
  4. Config 18F25K22
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2011, 19:08
  5. hserin
    By jcleaver in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 21st February 2007, 18:15

Members who have read this thread : 13

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