• Pic® Basic


  • MedianFilter

    A library module for use with Library Manager by JohnGB. This module has been written by Tim Box (Tim on PDS forum). The library module is offered on an as-is basis with no warranty as to its effectiveness, operation or reliability. Users use it at their own risk.

    Adds a new command called MedianFilter

    Syntax

    MedianFilter Array, Elements

    Overview

    Returns the median of the array by performing a bubble sort on the array and selecting the resulting middle element.

    Operators

    Array – any Byte array

    Elements - a constant, or byte variable indicating the number of elements within the array to sort

    Code:
    Include "PROTON_4.inc"
    Dim myarray[10] As Byte
    Dim index As Byte
    Dim temp As Byte
    
        Seed $0345
    
        For index = 0 To 9
            temp = Random
            myarray[index] = temp
            HRSOut Dec temp,32
        Next
    
        HRSOut 10,13
        temp = MedianFilter myarray, 10
        HRSOut "the median of the array is ",Dec temp
    
        Stop
    The above example code will fill an array with random values then extract the middle value.
    Notes:

    The array will be rearranged. Where the array is an even number the lower of the middle elements will returned.


    Download module

    Download: MedianFilter
  • Recent Activity

    teo-16018

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    teo Today, 19:23 Go to last post
    pic-ignorant-1162

    Proton Runtime Error

    Thread Starter: Paulcc

    I have proton running well on my laptop, but after installing it on my desktop, I get the following runtime error: "Runtime Error 217 at 000709FC" I...

    pic-ignorant Yesterday, 22:11 Go to last post
    David Barker-251

    UMC bootloader 18F46K22

    Thread Starter: shunt010

    Hi all. I am trying to build a UMC bootloader file for the 18F46K22, and it doesn't appear to work. It returns (in the error log) Error ...

    David Barker Today, 11:20 Go to last post
    barak-1433

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    barak Today, 16:06 Go to last post