High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?


Closed Thread
Results 1 to 8 of 8
  1. #1
    Seoullasers's Avatar
    Seoullasers Guest

    Post High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?

    Hello this will be my first post on the forum. I am an Educator from Canada whom has spent nearly 7 years working and living abroad in ROK and Japan.
    I came back to Canada almost 2.5 years ago and I am re-adapting to life here.




    I think I have an interesting predicament. I have an old code that I'd like to translate for use on a PIC18F2855. The problem is that not only does the code need translating from the PIC16F627A it also needs to be able to drive a 16x2 1602 display.
    I have been in touch with the creator of the code and he has given me full permissions to modify and use non-commercially. After I figure out what I need to do I will give him the code.

    Purpose of the code.


    I have a project that I am doing. This is modernizing a Survey Meter (Bicron Surveyor M) takes (GM tubes, proportional detectors as well as a multitude of
    various kinds of Scintillation detectors).
    The code in the .doc is for pulling in pulses and totalizing them at high speed (down to ~4uS). The program can take samples at CPS, CPM and a user defined count time (0.1/1/10/240..etc) windows.
    The data is displayed on an LCD screen and also sent over a simple serial connection (9600baud). That's all this program is designed to do essentially.

    I would REALLY like to adapt this code to make it run on a PIC18F2855. I recently got ahold of one of these PIC18F's as a pre assembled kit called a (ECIO28P).
    I haven't had much luck getting this code to adapt ( I've tried a number of changes and none has worked yet) . Additionally I'd like to be able to drive this on a 2x16 1602 (not over I2C) LCD screen if possible.

    I have attached a commented release of the code if this helps any. I am quite lost.

    **If there is anyone who would be able to have a look at the code and make suggestions or edits or show me what
    would need to be done to the code that'd be a major/ serious help.**

    Thanks.

    Attached Images Attached Images   
    Attached Files Attached Files

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?

    some things to consider
    1. is the pbp default config suitable [there is no such thing as a pic18f2855 chip so its just a guessing game]
    2. no attempt has been made to enable digital operation of chosen pins
    3. is there any conflict with pin usage on ECIO28P module [no data provided]
    4. is the t1clkin pin actually the same physical pin as per original chip [no schematic provided]
    5. the provided code is not in code tags and hence the formatting is woeful
    Warning I'm not a teacher

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default Re: High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?

    Welcome aboard seoullasers

    The chip on the ECIO28P is a 18F2455. Found here : http://www.matrixtsl.com/webshop/28-...c-18-ecio.html

    I haven't looked in detail at the differences between your suggested code and the actual hardware you wish to use. However, a few re-assignments may be needed to get this to work. The code looks good enough though not properly indented.

    You haven't mentioned your skill level working with PIC in general. For someone who may be just getting into PIC programming, it may be challenging to port code to another platform.

  4. #4
    Seoullasers's Avatar
    Seoullasers Guest


    Did you find this post helpful? Yes | No

    Post Re: High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2455?

    1) I think I goofed in the title. Should be PIC18F2455
    link here : http://www.microchip.com/wwwproducts/en/en010273


    2) What I gave to you was the commented release of the code. It doesn't address the pins. yes right...


    3) ECIO28P http://www.matrixtsl.com/resources/f.../ECIO-60-2.pdf see page 4.


    4) I'll attach the .bas files. to the thread to have a look at. I am totally unsure if this sketch will work.
    I don't have a PIC16F627A to look at to make a judgement call.

    Welcome aboard seoullasers

    The chip on the ECIO28P is a 18F2455. Found here : http://www.matrixtsl.com/webshop/28-...c-18-ecio.html

    I haven't looked in detail at the differences between your suggested code and the actual hardware you wish to use. However, a few re-assignments may be needed to get this to work. The code looks good enough though not properly indented.

    You haven't mentioned your skill level working with PIC in general. For someone who may be just getting into PIC programming, it may be challenging to port code to another platform.
    I've done a tiny bit of work with pics... very basic stuff. I am usually dealing with ATMega, ARM and some STM32... This programming language is completely new. I was hoping someone here could help me with the code.

    IF there is anything useful for you in these attached files.

    thanks..

    ScalerCST7r.basScaler11.basScaler1.bas
    Last edited by Seoullasers; - 25th February 2017 at 06:27.

  5. #5
    Seoullasers's Avatar
    Seoullasers Guest


    Did you find this post helpful? Yes | No

    Default Re: High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?

    Sorry for double posting here... I just had another go at editing the pins and finding a 1602 type LCD screen code to add in the beginning of the
    program. I had a look at the ECIO28P and saw different pins assigned. I changed the pins. Could someone have a look at my changes? Thanks. I tried adding this to my previous post, but that is not allowed... no choice.

    'PIC based Scaler for compact board
    '18F2455 16x2 1602LCD
    'V4.0 with configuration for CPS CPM uR and long sample option
    'V5 with count display during scaling
    'v6 skipped
    'V7 moved to PBP3 and bug fixes
    '(c)G8RPI 2011

    DEFINE OSC 20 'set for 10MHz xtal

    Not sure what I set the speed to I am wanting to set the speed to 48Mhz. but this is the internal clock. 4Mhz is external. Do I DEFINE OSC 20 'set for 4MHz xtal' ?
    What about the internal clock? How does one use that?

    DEFINE LCD_DREG PORTA ' LCD on port a
    DEFINE LCD_DBIT 0 ' Data bits A0..A3
    DEFINE LCD_RSREG PORTA ' RS on PORTA
    DEFINE LCD_RSBIT 1 ' RS on A1
    DEFINE LCD_EREG PORTA ' E on PORTA
    DEFINE LCD_EBIT 2 ' E on A2
    DEFINE LCD_BITS 4 ' LCD 4 bit mode
    DEFINE LCD_LINES 2 ' 2 line LCD display
    Define LCD_COMMANDUS 2000 ' Command Delay (uS)
    Define LCD_DATAUS 50 ' Data Delay (uS)


    LCDOUT $FE,1:PAUSE 3000:LCDOUT $FE,1 ' Initialize LCD WITH HUGE PAUSE !!!
    Pause 3000 ' AND AGAIN ...
    LcdOut $FE, $80," DUAL TERMOMETER "
    LcdOut $FE, $C0," AND THERMOSTAT "
    PAUSE 5000 ' AND AGAIN ...
    LCDOUT $FE, 1, $FE, $0C ' Clear display, cursor off
    Pause 1000

    input portB.3 'set to input as the board connects this pin (9) to the LM358 output pin 7
    input portB.0
    input portB.6
    input portA.4 'Switch input

    OPTION_REG.7 = 0 'Set portB weak pull-up on

    'Pins 10,11,12,13,14 are not connected
    'Pin 20 RB.0 is used to enter configuration
    'Pin 26 RB.6/T1CKI connected to Pin 9 and LM358 pin 7
    Last edited by Seoullasers; - 25th February 2017 at 07:40.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?

    before you go much further ;
    how do you plan to get your code into the ECIO28P , it uses some sort of bootloader .
    will the bootloader accept a HEX file? ,will it affect operation ? can you ditch the bootloader if you need to?


    Not sure what I set the speed to I am wanting to set the speed to 48Mhz. but this is the internal clock. 4Mhz is external. Do I DEFINE OSC 20 'set for 4MHz xtal' ? What about the internal clock? How does one use that?
    depends will the bootloader allow you to alter the config words ? most won't
    what accuracy do you need intclk is 1-2% acc ,ext 4mhz res ? , original had a xtal and was probably much better than either of these choices

    DEFINE LCD_DREG PORTA ' LCD on port a
    DEFINE LCD_DBIT 0 ' Data bits A0..A3
    DEFINE LCD_RSREG PORTA ' RS on PORTA
    DEFINE LCD_RSBIT 1 ' RS on A1
    DEFINE LCD_EREG PORTA ' E on PORTA
    DEFINE LCD_EBIT 2 ' E on A2

    DEFINE LCD_BITS 4 ' LCD 4 bit mode
    if porta 0:3 is the lcd data bus
    then porta 1 and 2 are already used and cannot be rs and e as well
    draw yourself a schematic using the ECIO28P footprint and how you think it will connect to everything else

    input portB.3 'set to input as the board connects this pin (9) to the LM358 output pin 7
    this means what ? is it the "probe counter output" ?
    if so is portb.3 suitable [I don't think so hint timer1 ext clk]
    Warning I'm not a teacher

  7. #7
    Seoullasers's Avatar
    Seoullasers Guest


    Did you find this post helpful? Yes | No

    Default Re: High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?

    The ECIO28P has a 4Mhz external Xtal, not a 10Mhz one.
    Setting the internal clock would make it faster, no? 48Mhz?

    input portB.3/pin9 (should be Pin23) is where the pulses come into the Pic to be counted at high speed.

    The bootloader does take .HEX files.. yes.. just not .bas files.


    I'm not sure on the LCD screen wiring... I'll have to have another look at a wiring guide for a 1602 series LCD on ECIO28P.

  8. #8
    Join Date
    Jan 2022
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: High speed pic scaler for Survey meter for PIC16F627A translation to PIC18F2855?

    Isn't it great when you give someone your source code for personal use and they put it on a public forum

Similar Threads

  1. High Speed Oscillator question
    By Tina10 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th July 2012, 11:29
  2. Pic based Wind Speed meter
    By Bobbo_ZA in forum mel PIC BASIC Pro
    Replies: 31
    Last Post: - 1st November 2011, 16:14
  3. Replies: 0
    Last Post: - 7th August 2008, 10:02
  4. High Speed Serial Comm PC - PIC and PIC - PIC
    By manumenzella in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 16th January 2007, 22:55
  5. Need help, high speed D/A converter, see code
    By rpatel in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 20th December 2004, 02:33

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