Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: Is there a HS comparator in the MM? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6125
Posted: 13 May 2018 at 2:41pm | IP Logged Quote Grogster

As per title, is there a HS comparator or a way of doing same within MM?

This is related to my other thread about model railway DCC ideas, and along with another page that posted a circuit for easily multiplexing UART serial across a low-voltage power line. She uses a HS comparator inside another PIC chip, but I don't seem to recall that the MM has that ability, unless I am missing something obvious - which I probably am.....

Failing that, I will use an external HS comparator such as the TS3011. But if the MM can do it, then that saves another three bucks for the external HS comparator is all.

__________________
Smoke makes things work. When the smoke gets out, it stops!


Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
panky
Guru
Guru
Avatar

Joined: 02 October 2012
Location: Australia
Online Status: Offline
Posts: 549
Posted: 13 May 2018 at 9:10pm | IP Logged Quote panky

G,

Don't know if there is a high speed comparitor but the following function takes about 230 uSec on a MZ running at 252MHz. Enter with 2 analogue in pins as a and b
You could optionally add a third variable which determines the hysteresis - in the example below I have set it at +/- 10 so with the 12 bit ADC in the MZ, this would be roughly 0.5%


function CompAB(a,b)
  if pin(a)+10 > pin(b)-10 then CompAB = 1
  els  eif pin(a)+10 < pin(b)-10 then CompAB = -1
  else
    CompAB = 0
  endif
end function



panky

__________________
DonTSM1,Duinomite,CGCMM1,CGCMM2,2xDimitech,3xWWuMites,MicksMuP,Grogster1A,4xPeterMuM+,Zonker DIP-600,3xCGuKits,CGuBoard2,SnadPic100,SCBP64 & Exp100,PMMZ144,PMMZ100 .. and loving it![:D
Back to Top View panky's Profile Search for other posts by panky
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2338
Posted: 13 May 2018 at 10:13pm | IP Logged Quote matherp

Quote:
As per title, is there a HS comparator or a way of doing same within MM?


Yes - see datasheet. However, using it would be tricky even in a CFunction as you can't get access to the interrupt
Back to Top View matherp's Profile Search for other posts by matherp
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6125
Posted: 14 May 2018 at 9:50am | IP Logged Quote Grogster

Lovely, thanks chums. External HS comparator it is, if I elect to go down that path.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 


If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Search the forums using Google.
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1104 seconds.
Privacy Policy     Process times : 0, 0.02, 0, 0.09