LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 03-21-2012, 01:21 PM   #1
PoleStar
Member
 
Registered: Jul 2010
Posts: 231

Rep: Reputation: 2
pickit 1 gpasm and all that


Here is the test code:
Code:
 include         <p16c745.inc>
                __CONFIG  _CP_OFF & _WDT_ON & _PWRTE_ON & _H4_OSC
                org             0
                movlw B'00000010'
                tris    PORTA
                movlw B'00000100'
                movwf   PORTA
               
 fin: goto fin
                  end
compliled:

Code:
[root@horse from-other-pdf]# gpasm -p p16c745  1.asm 
1.asm:7:Warning [224] Use of this instruction is not recommended.
[root@horse from-other-pdf]# gpsim  -p p16c74 1.hex

simulated:
It turn on the led on the simulator.

Code:
[root@horse from-other-pdf]# gpsim  -p p16c74 1.hex 

gpsim - the GNUPIC simulator
version: Release 0.26.1


type help for help
**gpsim> SimulationMode:52
FIXME gui_breadboard.cc Build

SetProcessorByType FIXME 
Extended linear address 0 0
Leaving pic_processor::LoadProgramFile
running...
WDT expired reset
0x0000000000AFC7FF p16c74 0x0000 0x3002 movlw   0x02
  Wrote: 0x0008 to status(0x0003) was 0x0008
  Wrote: 0x00FF to option_reg(0x0081) was 0x00FF
  Wrote: 0x0000 to pcl(0x0002) was 0x0000
Exiting gpsim
[root@horse from-other-pdf]#

HEX loaded on pickit(pic16c745)

Code:
[root@horse from-other-pdf]# usb_pickit.Linux.i386 --program 1.hex 
Locating USB Microchip(tm) PICkit(tm) (vendor 0x04d8/product 0x0032)
Found USB PICkit as device '012' on USB bus 005
Communication established.  Onboard firmware version is 2.0.2
PIC12F675 Rev 16 found
.hex file contains a configuration word
Writing 0 eeprom words
Writing 5 program words
.....
Calculated Checksum from .hex file: 0x06f0  
              Checksum from PICKit: 0x06f0  
Checksums are equal.  Device Programming Successful.
....
[root@horse from-other-pdf]#
It does not turn on the LED.

Last edited by PoleStar; 03-21-2012 at 01:23 PM.
 
Old 03-21-2012, 05:39 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 15,979

Rep: Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273
Quote:
[root@horse from-other-pdf]# gpasm -p p16c745 1.asm
1.asm:7:Warning [224] Use of this instruction is not recommended.
[root@horse from-other-pdf]# gpsim -p p16c74 1.hex
vim +7 1.asm

I don't remember 'tris' as an instruction. It could be valid. And you need to tell it the cpu type.
 
Old 03-22-2012, 01:35 PM   #3
PoleStar
Member
 
Registered: Jul 2010
Posts: 231

Original Poster
Rep: Reputation: 2
My mistake.

Actually pic16c745 is just help programming. Its pic12f675 is the one I should be writing the code for.
 
Old 03-23-2012, 04:31 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 15,979

Rep: Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273
reply is unchanged, as one pic assembler is like another.

vim +7 1.asm & fix

If you're on a pic, this has nothing to do with linux. It's hard initially, but you do it. The assembler must not complain at all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration