Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: Armmite - STM32H7: Developments Post ReplyPost New Topic
<< Prev Page of 18
Author
Message << Prev Topic | Next Topic >>
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2404
Posted: 01 September 2018 at 5:48pm | IP Logged Quote matherp

Quote:
OPTION LCDPANEL CONSOLE but short of a reset, I can't figure out how to stop the LCD acting as a console - any suggestions?


OPTION LCDPANEL NOCONSOLE, same as MM+


Back to Top View matherp's Profile Search for other posts by matherp
 
goc30
Senior Member
Senior Member
Avatar

Joined: 12 April 2017
Location: France
Online Status: Offline
Posts: 112
Posted: 01 September 2018 at 6:04pm | IP Logged Quote goc30

hi peter

I have a problem with input's pins
I want to use some pins in interrupt mode as explained in Micromite's doc like
SETPIN 42, INTH, Spbtn1
...
do
..
loop

sub Spbtn1

end sub


system send
Invalid configuraton

if I use without target, it accept my config and work correctly (need scanning in do...loop)
where is my fault ??

Edited by goc30 on 01 September 2018 at 6:06pm
Back to Top View goc30's Profile Search for other posts by goc30
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2404
Posted: 01 September 2018 at 6:32pm | IP Logged Quote matherp

Quote:
I have a problem with input's pins


Thanks for the report - hopefully this should fix it - no version change

2018-09-01_183214_Armmite1.3.zip
Back to Top View matherp's Profile Search for other posts by matherp
 
goc30
Senior Member
Senior Member
Avatar

Joined: 12 April 2017
Location: France
Online Status: Offline
Posts: 112
Posted: 01 September 2018 at 7:11pm | IP Logged Quote goc30



I field good

I have also an Rotary encoder and for that I need interrupt mode

thank peter

Edited by goc30 on 01 September 2018 at 7:12pm
Back to Top View goc30's Profile Search for other posts by goc30
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2404
Posted: 01 September 2018 at 7:29pm | IP Logged Quote matherp

Quote:
I have also an Rotary encoder and for that I need interrupt


Here is my patented switch-bounce immune rotary encoder I/F code

option default integer 
const false=0 
const true=1 
const in0=3 'encoder pins pulled high so should be reading high in detent positions, centre pin connected to ground
const in1=2 'swap the pin definitions as required to get the correct sense of rotation 

init: 
  setpin in0,intB,rint 'enable interrupts on both edges of both pins 
  setpin in1,intB,rint 
  rotatedright=false 
  rotatedleft=false 
  resetenc=true 
  value=0 
  lastvalue=0 
  print value 

MAIN: 
  Do 
    if value <> lastvalue then 
      print value 
      lastvalue=value 
    endif 
  Loop 
end 

sub rint: 
  pin0=NOT pin(in0) 'reverse sense to get positive logic 
  pin1=NOT pin(in1) 
  if pin0 then 
    if pin1 and not resetenc then 'in0 and in1 both active 
         if rotatedleft and not rotatedright then  
        value=value-1 
        rotatedleft=false 
      endif 
         if rotatedright and not rotatedleft then  
        value=value+1 
        rotatedright=false 
      endif 
    else 'only in0 active 
         if resetenc and not rotatedleft then 
              rotatedright=true 
              resetenc=false 
         endif 
    endif 
  else  
    if pin1 then  'only in1 active 
         if resetenc and not rotatedright then 
              rotatedleft=true 
              resetenc=false 
         endif 
    else  'both off so reset  
          rotatedleft=false 
         rotatedright=false 
         resetenc=true 
    endif 
  endif 
  if pin(in0)=pin0 or pin(in1)=pin1 then goto rint 're-enter if another change has happened almost immediately 
ireturn
Back to Top View matherp's Profile Search for other posts by matherp
 
goc30
Senior Member
Senior Member
Avatar

Joined: 12 April 2017
Location: France
Online Status: Offline
Posts: 112
Posted: 02 September 2018 at 2:14am | IP Logged Quote goc30

hi peter

I had to change your "rint" sub because I had an error (too many subs for interrupt)

new version
sub rint
rint2: 

  pin0=NOT pin(in0) 'reverse sense to get positive logic 
  pin1=NOT pin(in1) 
  if pin0 then 
    if pin1 and not resetenc then 'in0 and in1 both active 
      if rotatedleft and not rotatedright then  
        value=value-1 
        rotatedleft=false 
      endif 
      if rotatedright and not rotatedleft then  
        value=value+1 
        rotatedright=false 
      endif 
    else 'only in0 active 
      if resetenc and not rotatedleft then 
              rotatedright=true 
              resetenc=false 
      endif 
    endif 
  else  
    if pin1 then  'only in1 active 
      if resetenc and not rotatedright then 
              rotatedleft=true 
              resetenc=false 
      endif 
    else  'both off so reset  
          rotatedleft=false 
         rotatedright=false 
         resetenc=true 
    endif 
  endif 
  if pin(in0)=pin0 or pin(in1)=pin1 then goto rint2 're-enter if another change has happened almost immediately 
end sub


for digital inputs I use an anti-rebound procedure
my prog is like exemple prog in Micromite manual
option default integer 
const false=0 
const true=1 
const in0=49 
const in1=50 


Dim integer protb  'lecture pin 3 avec antirebond
Dim integer valrot  'valeur codeur rotatif
dim integer lastvalue
Dim integer vrot
Dim integer vrotsens   'sens de rotation 0=positif, 1=negatif


init: 
  setpin in0,intH,rint3 'enable interrupts on high of rot A pin 
  setpin in1,DIN     
  Protb=(Pin(in1) xor 1)  'to define first state of pin "B"
  value=0 
  print value 

MAIN: 
  Do 
'--- need 2 pass minimum with same value to confirm 
  Protb=((Protb*2) And 3) Or (Pin(in1) xor 1)
'----
    if valrot<> lastvalue then 
      print valrot
      lastvalue=value 
    endif 
  Loop 
end 

'-------  interrupt proc  ----
rint3:
  If Protb=3 Then  'state 1 confirm
    valrot=valrot+1
    'vrotsens=0
  End If
  If protb=0 Then  'state zero confirm
    valrot=valrot-1
    'vrotsens=2
  End If
  valrot
  'Print valrot
IReturn


I also cabled the circuit specified by manufacturer in datasheet (2 x 10k and 1 x 10nf))

Edited by goc30 on 02 September 2018 at 2:18am
Back to Top View goc30's Profile Search for other posts by goc30
 
CaptainBoing
Guru
Guru
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 662
Posted: 25 September 2018 at 9:01pm | IP Logged Quote CaptainBoing

TassyJim wrote:
Inbuilt editor seems to be happy.

I have created a spreadsheet with the pin mappings. MMBasic uses the CPU pin numbers.
The spreadsheet data is taken from the datasheet for the processor and the module.
There appears to be a lot of 5V tolerant pins which is nice to see.
2018-06-12_164535_NUCLEO-H743ZI-pinout.zip

Jim


Hi Jim.

I was just converting your spreadsheet into a load of Const statements so the ST notation can be used in my code and it threw up an error that D70 was already declared. Checking back to your spreadsheet, the offending lines are C:14 & C:55 on sheet 2

just sayin...
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2404
Posted: 25 September 2018 at 10:31pm | IP Logged Quote matherp

C55 should be D7
Back to Top View matherp's Profile Search for other posts by matherp
 
CaptainBoing
Guru
Guru
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 662
Posted: 26 September 2018 at 12:21am | IP Logged Quote CaptainBoing

thanks
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 


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.
<< Prev Page of 18
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.1094 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.11